Can't use DLL (written in C++) in Delphi: The procedure entry point could not be located -
I've compiled a DLL in Visual Studio (the source code is in C ++, which I hardly understand).
Here is a piece of Scraper.h :
Struct swin {char title [512]; Hwd; hwd; }; SCRAPER_API bool ScraperGetWinList (SWIN winList [100]);
Now I am trying to use the above work in my Delphi application:
type tWin = record title: string; Hwnd: hwnd; End; Function ScraGetWinList (var WinList: TWN Aare): Boolean; External 'Scraper.dll'; Var myWilList: Array [1..100] of Tewin; Process TMainForm.GetWinListButtonClick (Sender: TObject); Start ScraperGetWinList (myWinList); ...
This project is not compiled, and I get the following message: The process entry point may not be located in the ScraperGetWinList Dynamic Link Library: Scraper.dll .
What am I doing wrong?
With my Linux experience, I would say that you have encountered the so-called "issue" of your process The entry point is not "ScraperGetWinList", but nothing like "_ZN18ScraperGetWinListEpN4SWin".
This is that, unlike C, the entry point in the C ++ language is not the same as the name of the function is not surprising: assuming you have a set of overloaded functions; You must have different entry points in your DLL
The most common solution to this problem is to define your library's interface in such a way that it will use the calling calling convention.
Note that you do not have to write the entire library in C. You should only emit C for the declare function, just like entry points.
Typically it has been written as:
extern "c" {SCRAPER_API bool ScraperGetWinList (SWIN winList [100]); // more work}
Recompile your library and use it without any problems in Delphi.
Note , you should also adjust calling conventions (Stdcall or cdecl) to match in their C + + header and Delphi code. However, it is best explained in another question.
Comments
Post a Comment