Use of a DLL written in Delphi Xe2
-
Hi,
I have to use functions from a Delphi Xe2 DLL and i'm having some troubles.
I use QLibrary to dynamically load the DLL at run time. All the functions are found in the DLL by the resolve function but when i call the first function (init function) my app crashes and exit with code 0.
Maybe the problem comes from my function prototypes definition :
typedef int (WINAPI *Init_ptr) ();
In the doc :
"Function Init : integer ; stdcall "
return 0 if no errorIt's the first time i'm using a library (moreover in Delphi) so i don't know where is the problem.
Any help/explanation about my problem or about DLL in general will be useful.
Thx
-
Hi,
I have to use functions from a Delphi Xe2 DLL and i'm having some troubles.
I use QLibrary to dynamically load the DLL at run time. All the functions are found in the DLL by the resolve function but when i call the first function (init function) my app crashes and exit with code 0.
Maybe the problem comes from my function prototypes definition :
typedef int (WINAPI *Init_ptr) ();
In the doc :
"Function Init : integer ; stdcall "
return 0 if no errorIt's the first time i'm using a library (moreover in Delphi) so i don't know where is the problem.
Any help/explanation about my problem or about DLL in general will be useful.
Thx
-
@jsulm Yes... i think ^^
typedef int (WINAPI *Init_ptr) (); Init_ptr Init=NULL; if(lib->load()){ Init=(Init_ptr)lib->resolve("Init"); } if(Init!=NULL){ int res=Init(); // The app crashes here }
Am I doing something wrong ?
-
@jsulm Yes... i think ^^
typedef int (WINAPI *Init_ptr) (); Init_ptr Init=NULL; if(lib->load()){ Init=(Init_ptr)lib->resolve("Init"); } if(Init!=NULL){ int res=Init(); // The app crashes here }
Am I doing something wrong ?
-
@Zoptune
Your doc doesn't seems to be helpful.Are you sure that this library is operational with your build ? I know that Windows doesn't like to mix library build mixed (one with CRT of Visual Studio 2003, with another library using the crt of Visual Studio 2015).
Furthermore « crash » is not helpful, because the cause of the crash maybe intern to your library (i.e. you make a good call, but the library doesn't initialize well); don't you have an error message/code ?
Did you test to load that library with a regular and plain hello world in visual studio ?
Hope all my questions will help you.
P.S. : I suppose that you don't have the code of the library but must use it ? Can't you ask the support an C++ example ?
-
Thx all for your replys. The problem came from inside the function of the DLL.
In fact, the library allow me to do some task on a machine.
This machine is connected to my LAN.The problem was that the machine has a fixed IP address and this IP was out of my LAN.
Had to use Wireshark to find the problem ^^Thx for help :)