DLL Error 127 - page 2

 
n2535904: Thanks Raptor. My post is edited. I don't really need assistance with posting, 
  1. Apparently you did need assistance with your posting or RaptorUK wouldn't have said so and you wouldn't have edited your post. Get off your high horse.
  2. Did you enable DLL calls in the options and EA settings?
 
xcoder:
I tried from other drive (e:/) still getting that error. Moreover, I used codeblocks to generate the dll, along with the dll a file (.def) is also generated, but even putting them in libraries along with .def gives 127 error ? someone please help.

1. Don't use _stdcall when writing with Code::Block

2. There's dll sample in MT installation located at experts/samples 

 
SquareRoot:

I am receiving the following error message

Cannot call function "xxx" from DLL " xxx" (error 127)

This is a commercial indicator (not EA). I have run the indicator successfully on 2 of my computers with WinXP. A third WinXP computer gives me this error message. The DLL file is in the experts/library folder. I'm not sure what else could be the cause of this error.

Any solution or ideas would be greatly appreciated.


Had a same issue on VS2010. The names of exported functions were changed and thus was getting the 127 error.


The reason is that dllexport of a C++ function will expose the function with C++ name mangling. If C++ name mangling is not desired, either use a .def file (EXPORTS keyword) or declare the function as extern "C". http://msdn.microsoft.com/en-us/library/3y1sfaz2%28v=vs.100%29.aspx


The correct function declaration (.def not needed) looks like this:


extern "C" __declspec(dllexport) int square(int i)
{
return i * i;

}


Regards and good luck

Reason: