Eleni Anna Branou:
Please use the </> button to insert your code.
Done, thanks for pointing out.
Check if this helps.
Forum on trading, automated trading systems and testing trading strategies
Crash when string is passed to a C++ DLL function
Goldbach, 2009.10.29 04:33
I correct this issue by adding __stdcall in my export funtion.
Thanks a lot!!!!!
Alain Verleyen:
Check if this helps.
Thanks for the link, I check out, but this is C++, and I don't know how different it is to do this from C#.
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 void __stdcall EALOG_WriteLine(char *str) { MessageBoxA(NULL, str, "", MB_OK); }
For example I'm not sure how this EALOG_WriteLine function (which is the one being called) would translate for a C# dll.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I would like to ask how to pass some kind of data, like string to my C# dll. This questions has been answered for C++: How to pass argument by reference from MQL4 to C++ DLL
However in my case I want my C# code to get this value from mql4 and then do something with it (so all this while in the C# code).
Here is my attempt:
My C# DLL:
MQL Code:
It's probably a similar approach, but is this still the best way to go, and could someone provide a minimum example of doing this in C#?