C# program is managed code. but C/C++ and MQL are unmanaged code.
if you want call betweent them, need some complex consideration.
see Interop or P/Invoke in VS 2005 help.
I think you need a C/C++ code to pack or wrap C# code, give a interface in a general
native dll.
MQL4 only can call native dll. (note there are 2 kind of dll now !!! )
so using C# to code a dll, which can not called by MQL4 directlly.
if you not know what is managed code and unmanaged code (native ), you cannot know
how to do.
so only can use C/C++ to code a native dll for MQL4 using.
or wait MT can supply interface for C# in future.
suggest MT constructs a interface for C#, only a dll with functions transfering
data.
Don't waste your time with VS. If you like C/C++ so much use Dev-C for native C/C++
dll. I was a Pascal programmer, and now I'm using Dev-Pascal to create dlls usable
by MT.
TheEconomist:
Don't waste your time with VS. If you like C/C++ so much use Dev-C for native C/C++
dll. I was a Pascal programmer, and now I'm using Dev-Pascal to create dlls usable
by MT.
Could you post the code required for this simple dll, as I've been experimenting
with dev-c++'s default dll project without success.
I would appreciate any help here.
My zap.cpp is below. What should be in the header?
I have a zap.def as well.
It all compile to a zap.dll, importing which I get the err127 when calling Hello().
#include "zap.h"
#include <windows.h>
#define MT4_EXPFUNC __declspec(dllexport)
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
/* Returns TRUE on success, FALSE on failure */
return TRUE;
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
if you want call betweent them, need some complex consideration.
see Interop or P/Invoke in VS 2005 help.
I think you need a C/C++ code to pack or wrap C# code, give a interface in a general native dll.
MQL4 only can call native dll. (note there are 2 kind of dll now !!! )
so using C# to code a dll, which can not called by MQL4 directlly.
if you not know what is managed code and unmanaged code (native ), you cannot know how to do.
so only can use C/C++ to code a native dll for MQL4 using.
or wait MT can supply interface for C# in future.
suggest MT constructs a interface for C#, only a dll with functions transfering data.
Don't waste your time with VS. If you like C/C++ so much use Dev-C for native C/C++ dll. I was a Pascal programmer, and now I'm using Dev-Pascal to create dlls usable by MT.
I would appreciate any help here.
My zap.cpp is below. What should be in the header?
I have a zap.def as well.
It all compile to a zap.dll, importing which I get the err127 when calling Hello().
#include "zap.h"
#include <windows.h>
#define MT4_EXPFUNC __declspec(dllexport)
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
/* Returns TRUE on success, FALSE on failure */
return TRUE;
}
MT4_EXPFUNC void __stdcall Hello()
{
HWND hWnd=NULL;
LPCTSTR lpText="hello world";
LPCTSTR lpCaption ="";
UINT uType = 0;
MessageBox(hWnd,lpText,lpCaption,uType);
}