parametr to called dll function

 

Hi,

I haved read some topics about this problem but i don't find a solution.


in my c++ code i have:

void __stdcall DLL_EXPORT exportdata(std::string [1] data);

and :

void DLL_EXPORT exportdata(string [2] data)
{
anotherfunction([3]data[4]);
}


in mt4:

#import "mt4_dll1.dll"
   void      exportdata(string [5] data);

 #import

and

string valeur =  ";";  exportdata(valeur);

What i have to put on
[1];[2];[3];[4];[5]

because i obtain ass result of some combimation of "*" or "&" "0" or 2 different hex data/addr "0x123456" ass result (or a critical error in mt4)


I'm sorry for my eng. And thanks you for any idea.
 

hm. I have understand the principe but i obtain the same result.

The best one is with:

struct MqlStr
{
    int len;
    char* string;
};

in the c++ code, but the result is "0".

Some idea?

 

strings will be passed as pointers to ordinary good old fashioned null-terminated C strings.

void foo(char *s)

the above mentioned struct with the length is only used in arrays of strings. There it will pass a pointer to an array of these structs. Don't use it unless you really want to pass arrays to the dll.

 

why it's don't work tjis mornning at 1 o'clook? :]

thanks to all

Reason: