I am trying to use a DLL from Visual C in D10.1 and the declaration is this:

I am trying to use a DLL from Visual C in D10.1 and the declaration is this:

void __cdecl setProperty (int state)

I have declared my procedure as:

procedure SetProperty (const autoCheck: Boolean);
var
tmpProc: procedure (state: NativeInt); cdecl;
begin
//Here I load the DLL in another procedure and keep the handler fHandle
@tmpProc:=GetProcAddress(fHandle,'setProperty');
if Assigned(tmpProc) then
begin
if autoCheck then
tmpProc(1) <--ERROR HERE
else
tmpProc(0);
end;
end;

When I debug the code, tmpProc gets an address, which I think means that setProperty is loaded from DLL.

Then when the code goes to tmpProc(1) I get the following error:

Debug Output:
Executable doesn't have required key in StringFileInfo: The specified resource type cannot be found in the image file.

Process Project3.exe (4972)

What does this mean? Thanks

Comments

  1. David Heffernan I used this guide: http://docwiki.embarcadero.com/RADStudio/XE8/en/Delphi_to_C%2B%2B_types_mapping

    There are two entries for int in C(++). I will change it to integer. Thanks

    ReplyDelete
  2. That documentation is wrong. NativeInt is pointer sized. It maps to intptr_t. Integer maps to int.

    ReplyDelete
  3. David Heffernan You're right David. I changed that and now it works.

    ReplyDelete

Post a Comment