Jump to content
Excelsior Forums
Sign in to follow this  
excbv

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 *>

MODULE Test;

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

CONST

 Msg=M.Msg;

               

VAR

 hmod: dllRTS.HMOD;

 Unzip: U.SEUF;  

BEGIN

 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

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

<* M2EXTENSIONS+ *>

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

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

DEFINITION MODULE ["StdCall"] Unzip;

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  

×