Error 127 calling a dll function ? Please help. - page 2

 
7bit:

Alternatively you could abandon the use of this ancient C++ entirely and use appropriate and modern language and tools for creating dlls like for example Delphi or FPC/Lazarus. This would save you a lot of headache since everything will be much more intuitive and less error prone.

 

 

 

 

> If you check on wikipedia you will see that pascal (from which delphi derives) is older than C (1970 vs 1972.) C++ is from 1979. You tell me which is more "modern".

 

And Object Pascal is from 1986, so it is more modern than C++. It had the chance to learn from all of C++'s design errors and it did. Also it is more modern since it is still being developed further, simply because it can! (at the very moment we speak here there is work going on to further improve the compiler and the language features while C++ compiler developers can only desperately try to work around unfixable flaws in the language design itself). The Object Pascal from today has not much to do with the good old Pascal from the 70s (and even that was already superior to its competitor C). It has evolved into a very consistent and modern language and is actively developed further without making the language a hopeless mess that is broken beyond repair like C++.

The user base of FPC has been growing exponentially since many years and keeps growing at the very moment we speak here. Object Pascal is the reincarnation of the good old Pascal as a modern language usable for today's needs with exponentially growing momentum.

The Lazarus IDE is unique and fills some huge gaps in cross platform application development where there is NO competition at all. You won't find anything comparable to Lazarus/FPC, neither free nor commercial. It is miles ahead of anything else in this league (systems programming languages). For C++ there exists nothing even remotely comparable. The next closest thing would be Java/Netbeans but this does not produce native code and GUI apps don't use the native Widgetset of the target platform, so it is not playing in the same league.
 

I am still getting that 127 error, someone please help.

I tried copying the dll, the .def both to experts/libaries and moreover, I've installed mt4 on non-root drive(e:)

main.cpp

#define MT4_EXPFUNC __declspec(dllexport)
// a sample exported function

MT4_EXPFUNC double _stdcall Hello( int i)
{
        return( i*10);
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:
            // attach to process
            // return FALSE to fail DLL load
            break;

        case DLL_PROCESS_DETACH:
            // detach from process
            break;

        case DLL_THREAD_ATTACH:
            // attach to thread
            break;

        case DLL_THREAD_DETACH:
            // detach from thread
            break;
    }
    return TRUE; // succesful
}

my.mq4

#import "mt4dll.dll"
double Hello(int);

   int init(){
      Print("Account Number : ",AccountNumber());
   }
   
   
   int start(){
      Print(Hello(89));
   }
 
Why are you spamming the forum with different identical copies of the same old question (which has been answered a hundred times already btw)? See my answer in the other thread.