Hello codersguru!
Great courses you write there. Thanks.
I try to create a dll and test it on MT4. I have an error code 127 (
cannot call function 'Test' from dll 'ExpertSample.dll' (error 127))
Here is all the process i do:
1. write the .cpp:
Quote:
#define WIN32_LEAN_AND_MEAN
#define MT4_EXPFUNC __declspec(dllexport)
#include <windows.h>
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return(TRUE);
}
MT4_EXPFUNC int __stdcall Test()
{
return(12);
}
|
2. i write the .def:
Quote:
LIBRARY ExpertSample
EXPORTS Test
|
3. I compile, no error, and i put the ExpertSample.dll in the \experts\libraries folder
4. i create my mq4 test file:
Quote:
#property indicator_chart_window
#import "ExpertSample.dll"
int Test();
#import
int init() { return(0); }
int deinit() { return(0); }
int start() { Alert( Test() ); return(0); }
|
5. i compile, no error
6. Attach the indy test on chart, check allow dll and ... error 127.
In VC++ i have problem to compile because of windows.h is not find. Then i use DevC++ or Code::Blocks with no error at compile.
My questions: did i forget something, in coding, in c++ project parameters or something else?
Thanks for your help.
FerruFx