Download MetaTrader 5

DLL import alias problem (decorated names)

To add comments, please log in or register
Mihai Ionescu
1505
Mihai Ionescu  

I have a DLL which I use in MT4, but it doesn't seem to work in MT5.

All functions are in this form: _nameOfFunction@24

instead of 24, some functions there are with @40,@4 etc...

from what I saw, these are under the term of "decorated names"

MT4 recognized these names of functions, but MT5 doesn't compile because of the @'s presence: 

'@' - unknown symbol 

 

Is this a bug? Or it's just undocumented? 

Can someone please help me?

Because documentation says nothing about anything like this, and I don't have anywhere to look elsewhere, as I just finished searching the web.

Mihai Ionescu
1505
Mihai Ionescu  

I resolved this issue myself after more investigation into c++, dll, decorated names, compiling dll, etc.

In MT4 I imported the decorated names and it worked.

Looking into DLL file, you find the list of functions with decorated names (probably created by the compiler I guess, I'm new to this). So you have to see the source of dll.  

After looking inside original c++ sources Now, I had to import the original name of the function.

It worked:)

Anyway, maybe someone will post here if decorated names will be supported in the future in MQL5.

Bogdan Caramalac
1112
Bogdan Caramalac  

Last time I made a dll it was in the 90s. I remember there was the option to export by name, by a fake name, and by index. And I'm sure that in the index version compiler didn't place any kind of names in the compiled dll. Alas, these were 16 bit dlls.  I don't know if after switching to 32 bit model the index export still remained valid. But I think a dll with functions exported by index could not possibly be imported here.

Do you know how to import a COM dll in MQL5 ?

Mihai Ionescu
1505
Mihai Ionescu  
TheEconomist :

Last time I made a dll it was in the 90s. I remember there was the option to export by name, by a fake name, and by index. And I'm sure that in the index version compiler didn't place any kind of names in the compiled dll. Alas, these were 16 bit dlls.  I don't know if after switching to 32 bit model the index export still remained valid. But I think a dll with functions exported by index could not possibly be imported here.

Do you know how to import a COM dll in MQL5 ?

You are more advanced than me in knowledge about dlls. 

If I were you, I would try MT4 to see if it can. If MT4 can't, small chances MT5 can:P 

Ilyas
1205
Ilyas  
ifmihai :

I resolved this issue myself after more investigation into c++, dll, decorated names, compiling dll, etc.

In MT4 I imported the decorated names and it worked.

Looking into DLL file, you find the list of functions with decorated names (probably created by the compiler I guess, I'm new to this). So you have to see the source of dll.  

After looking inside original c++ sources Now, I had to import the original name of the function.

It worked:)

Anyway, maybe someone will post here if decorated names will be supported in the future in MQL5.

 

 

Please read about "name mangling". It impossible to support all decorations.
Mihai Ionescu
1505
Mihai Ionescu  
mql5 :
Please read about "name mangling". It impossible to support all decorations.

It sounds logical.

Thanks for clarification (name mangling). 

To add comments, please log in or register