Jump to content
Excelsior Forums
Sign in to follow this  

again on DLL's

Recommended Posts

I would like to use a "foreign" DLL (specifically Infozip's unzip library). I use a piece of program as follows:

<*+ MAIN *>


IMPORT dllRTS,M:=Msg,S:=SYSTEM,W:=Windows,U:=Unzip;





 hmod: dllRTS.HMOD;

 Unzip: U.SEUF;  


 hmod := dllRTS.LoadModule("unzip32");

 IF hmod=dllRTS.InvalidHandle THEN Msg("unable to load unzip32.dll")

 ELSE Unzip := S.VAL(U.SEUF,dllRTS.GetProcAdr(hmod,"Wiz_SingleEntryUnzip"));

   IF Unzip=NIL THEN Msg("Bad!") END


END Test.

However the compiler complains that it cannot find unzip32_BEGIN.  Now, the User's Manual explicitly states that one can leave a DLL uninitialized (Section Run-time dynamic linking); but this example indicates that an attempt is always made to initialize the DLL (?!)

Regards. BV

Share this post

Link to post
Share on other sites

It seems that what is needed is to declare the Unzip definition module as follows


<*+ CSTDLIB *>      (* C standard library *)

<*+ NOHEADER *>     (* we already have header file *)


Also all procedures that are passed to the DLL must have the "StdCall" modifier

Regards, BV

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this