Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Help needed to call dll function


2 replies to this topic

Swati Das

Swati Das
  • Full Members
  • 4 posts

Posted 07 April 2009 - 14:24

Hi,

I want to call a function in a dll. For this I am using the UseDll function and then I am calling the function. Following is the excerpt of what I want to do:

#define DLL_FILE "C:\\testdllmfc.dll"

// Prototype checkbitversion in testdllmfc.dll.

prototype cdecl testdllmfc.checkbitversion();

function OnOSBitVersionCheck()

STRING svString;

INT nValue;

NUMBER nResult;

begin

UseDLL (DLL_FILE);


if (nResult = 0) then

MessageBox ("UseDLL successful \n\n.DLL file loaded.", INFORMATION);

else

MessageBox ("UseDLL failed.\n\nCouldn't load .DLL file.", INFORMATION);

abort;

endif;

checkbitversion(); //This is the function call I want to make from the dll

if (UnUseDLL (DLL_FILE) < 0) then

MessageBox ("UnUseDLL failed.\n\nDLL still in memory.", SEVERE);

else

MessageBox ("UnUseDLL successful.\n\n.DLL file removed from memory.",

INFORMATION);

endif;

end;


Now when I launch my Installshield exe, my dll does gets loaded. But I am getting the following unhandled exception error:

Error: 0x80040703
Description : Failed to find dll function testdllmfc.checkbitversion



I am using a VC++ mfc dll. Then from google we got to know that we have to make the prototype as extern "C" __declspec( dllexport ) void checkbitversion(). But still I am getting the error.

Please help me out as to how can I fix this issue. I am new to InstallShield and also am not good at creating dlls using VC++.


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 07 April 2009 - 15:13

Your IS code looks to be the right approach, so I would expect the problem lies in your DLL.

Therefore, to check your DLL, I would load it up under Dependency Walker to confirm the function definition and then use Windows rundll32.exe to confirm the calling of it.

Hope it helps.
user posted image

Swati Das

Swati Das
  • Full Members
  • 4 posts

Posted 10 April 2009 - 09:47

I was able to call the dll function. There was some error in the way I was creating the dll. Anyways, thanx for ur help.