Hi all!
I have got a little Problem and I hope someone of you knows how to solve it.
I wrote an own c++ .net dll (VS CLR Project) and use it through the reference option in Axapta.
Well so far no problem.
When i try to pass a string from Axapta to the dll it does not work and I have no more idea how to pass a string to this dll.
Here a bit source code so you can imagine what i did.
MyDLL.h:
#pragma
once
using namespace System;
namespace MyDLL {
public ref class SumClass
{
public:
// constructor
static SumClass();
// returns a + b
double AddNumbers(double a, double b);
void stringTest(char* input);
};
}
MyDLL.cpp:
#include
<stdio.h>
#include <windows.h>
#include <iostream>
#include <atlimage.h>
#include "ximage.h"
#include "MyDLL.h"
using
namespace std;
namespace
MyDLL
{
static SumClass::SumClass()
{
}
double SumClass::AddNumbers(double a, double b)
{
return a + b;
}
void SumClass::stringTest(char* input)
{
}
}
The AddNumbers function works fine within Axapta, but in my stringTest function he always says that "The class does not contain this function".
So here the code how i use the DLL in Axapta:
real a = 5;
real b = 10;
real result;
str inputString;
MyDLL.SumClass myDLL = new MyDLL.SumClass();
;
result = myDLL.AddNumbers(a, b);
// this does not work probably because of char* on dll side
// but how to solve?!
myDLL.stringTest(result);
info(strfmt("Ergebnis: %1", result));
The first function "AddNumbers" works fine and without any problems. But how can i pass my string to the "stringTest" function?
Does anyone of you has an idea?
Thanks in advance!
Kind regards, Steven