🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #565

Re: Help! Need to link 16bit LIB with 32bit Application

#565
From: Glenn Horton
Date: Wed, 29 Jul 1992 20:39
57 lines
2732 bytes
In article <anderson.16.712435941@mayo.edu>, anderson@mayo.edu (Alfred I. Anderson) writes:
|> Sybase distributes a .LIB file that is linked in with a C appliaction to 
|> allow access to their data base on the network.  Apparently it is not 
|> possible (?) to link this file against an application developed with the IBM 
|> CSet/2 compiler in 32 bit mode??
|> 
|> Apparently the OS/2 2.0 linker can only call 16bit DLLs and cannot 
|> incorporate 16bit LIBs!  For our application, we must access this 16bit .LIB.
|> 
|> Does anyone have a suggestion how we can link to this 16bit LIB??
|> 
|> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|> Alfred Anderson                Internet:    anderson@Mayo.edu
|> Mayo Foundation - Rochester MN 55905
|> 
|> NOTE:  PLEASE INCLUDE YOUR RETURN ADDRESS IN THE BODY OR .SIG FILE
|> OF ANY NOTE SENT TO ME --- THE SOFTWARE ON MY END DOES NOT PASS 
|> YOUR RETURN ADDRESS FROM THE MESSAGE HEADER TO ME!
|> -----------------------------------------------------------------

	We don't use IBM's compiler so this may not help but you can 
give it a try.

	Most .lib files are stub libraries that just serve to resolve
external references to functions that actually live in a dll. What we
did to get around this is 

(1) determine what functions live in what 
DLLs. You can most likely so this by dumping the DLL as a text file.

(2) use IMPORT statements on the linker to resolve the external 
references. This is the part that your system may not support.



	An alternate technique to step 2 is as follows.
(1) Use DosLoadModule to load a DLL and get a handle for it, for example...

DosLoadModule((PSZ)&buf, sizeof(buf), "NETAPI", &dllptr))

(2) Use DosQueryProcAddr to get the addresse of the function you want to
call, for example...

DosQueryProcAddr(dllptr, 0, "NETBIOSENUM", (PFN FAR *)&nbenum))

(3) Call the functio through a function pointer, for example...

(*nbenum)(...);


	I hope this helps. If you have any more questions just send e-mail.
I can't guarantee I'll read this newsgroup again soon.
-- 

Glenn Horton            SAS Institute Inc.
sasdgh@unx.sas.com      919-677-8000 x6640
Technical Details
Message-ID: <Bs6428.D9L@unx.sas.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rutgers!concert!sas!mozart.unx.sas.com!sasdgh
References: <anderson.16.712435941@mayo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!rutgers!concert!sas!mozart.unx.sas.com!sasdgh
From: sasdgh@cedar.unx.sas.com (Glenn Horton)
Newsgroups: comp.os.os2.programmer
Subject: Re: Help! Need to link 16bit LIB with 32bit Application
Message-ID: <Bs6428.D9L@unx.sas.com>
Date: 29 Jul 92 20:39:44 GMT
References: <anderson.16.712435941@mayo.edu>
Sender: news@unx.sas.com (Noter of Newsworthy Events)
Organization: SAS Institute Inc.
Lines: 57
Originator: sasdgh@cedar.unx.sas.com
Nntp-Posting-Host: cedar.unx.sas.com