|Posted by:||Markus (markus.hu…@freenet.de)|
|Date:||30 Mar 2006|
I've got a dll with these functions/procedures exported:
procedure init; STDCALL;
function init_kommunikation(art:DWORD; portname:PCHAR;
function get_dll_info:tebmcomlibrary_info; StdCall;
p:tPSendBuffer; size:DWord):tLisaNtError; STDCALL;
All are STDCALL and exported like this:
get_dll_info, //index 1,
send_data, //index 2,
check_handle, //index 3;
init, //index 4,
init_kommunikation; // index 5,
The declarations of some parameters are this:
PROCEDURE(s:tSendbuffer; size:DWORD; quelle:PCHAR) of object;
tcommunicationhandle = WORD;
tebmcomlibrary_info = packed RECORD
reserviert:ARRAY[1..233] OF BYTE;
tSendbuffer = ARRAY[1..256] OF BYTE;
tPSendBuffer = ^tSendbuffer;
tLisaNtError = Integer;
The test app and the dll are both compiled with this setting:
In a test application the dll is loaded via loadlibrary and the procedures are imported via GetProcAddress. Some address is returned but calling these mostly hangs. If one follows the call in the CPU-window, one sees that the first thing done after the call of the procedure (also within it) is a jump to a memory adress which seems to be "nirvana".
If you shorten the name of init_kommunikation to init_kommunik then this one works, but a test of send_data fails with the same results as before. So there must be some fundamental bug still in it.
How can I find it?
What tools can I use?
What should I do?
Oh, I'm using Delphi 2006 Arch. if that matters.