External function calls with multiple dependent DL

2019-07-19 01:08发布

I want to call a couple APIs from a DLL that has a number of dependent DLLs. I added all the DLLs to the setup package and defined the prototypes:

function myapi_Init(): Integer;
external 'myapi_init@A.dll stdcall setuponly loadwithalteredsearchpath delayload';

I extract all the DLLs using ExtractTemporaryFiles('*.dll') just fine in InitializeSetup() and then attempt to call the respective API. I get a runtime error, cannot import dll...

I redefined the prototype as follows and removed the call to extract the DLLs:

function myapi_Init(): Integer;
external 'myapi_init@files:A.dll,B.dll,C.dll,D.dll,E.dll stdcall setuponly loadwithalteredsearchpath delayload';

This works fine. I checked and in both cases, all the appropriate DLLs are extracted and in the same place. I prefer the first case because it avoids spelling out all the DLL names for each API. What am I doing wrong in the first case to cause failure?

0条回答
登录 后发表回答