Download MetaTrader 5
To add comments, please log in or register
Find out the latest MQL5.community news!
crn
44
crn 2014.02.24 20:27 

Hi,

I using for development QtCreator and newwest MinGw. For Build 600 I didnt get any problem. After that build I got SEGFAULT when I try call any function.

I using def file;

Example:

extern "C"

{
int dll_test( MqlStr * str);
}

 int dll_test( MqlStr * str)
{
    info("test");
   return 0;
};

DllMain function is called. I got inforation when:
DLL_PROCESS_ATTACH
DLL_PROCESS_DETACH


Anybod Could help?

Big regards
ydrol
595
ydrol 2014.02.24 22:17  
Hi see here
crn
44
crn 2014.02.24 22:35  

I used this struct ( i found this art)


struct MqlStr

{
    int len;
    wchar_t* string;
    int dummy; // for padding
};

Also in my function I dont call any obejct.pointers/etc from parameters

So that is mabye call convention?

Maybe __stdcall ls not correct for new build?

MT4 Code:
#import "pocBuild600.dll"
int dll_test(string &s);
#import
Withoud any code (i try only logger/messagebox etc., print int to std,file,any action ) I got error of MT4 and terminated process.

Anybody have idea why?
micclly
187
micclly 2014.02.25 01:34  

If you want to pass just a string, try to use wchar_t* instead of MqlStr.

string argument (in MQL) is not needed defined as string& but string.

If you want to pass back the string from dll into the argument, allocate ushort[] variable in mql and pass it to dll, and receive it as wchar_t* in dll side.


Add: you had pasted the src code and manually highlighted it? try to use SRC button in the toolbar of this form!

/
To add comments, please log in or register