delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/07/17:48:18

From: root AT jacob DOT remcomp DOT fr (root)
Subject: Re: MSVC link: How to convert a .lib to a .dll
7 Jul 1997 17:48:18 -0700 :
Sender: mail AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <m0wlMR4-000AK2C.cygnus.gnu-win32@jacob.remcomp.fr>
Original-To: pjm AT rbd DOT com (Paul J. Metzger)
Original-Cc: gnu-win32 AT cygnus DOT com
In-Reply-To: <Pine.LNX.3.91.970707170446.16490H-100000@thunder.rbd.com> from "Paul J. Metzger" at Jul 7, 97 05:32:26 pm
Original-Sender: owner-gnu-win32 AT cygnus DOT com

> 
> The MSVC libraries I need to use have been provided as .LIBs by a
> third party.  Is there an easy way to convert these to DLLs without
> access to their source code?
> 							- Paul
> 
It could be done as follows:
First Method:
------------
1. Build a C file with a function table. In that table you should
   put all functions you want to use. This is to force the linker
   to include all the object files from the .lib. Maybe there is
   an option to force LINK.EXE to include an object file.
2. Build a dummy 'LibMain'
3. Build a .def with all the exports you need
4. Link with your .lib using link.exe.
Second method:
-------------
1. Extract all the object files from the .lib using LIB.EXE
2. Build a dummy C file referencing all the functions you need.
   Either with a direct call or with an initialized function pointer.
3. Build a dummy LibMain
4. Link all the objects with this file+LibMain.
5. Write a .def.
6. Link.

This is a lot of work (half a day or so), but much less than writing
the runtime library of msvc under cygnus... :-)

Good luck!

-- 
Jacob Navia	Logiciels/Informatique
41 rue Maurice Ravel			Tel 01 48.23.51.44
93430 Villetaneuse 			Fax 01 48.23.95.39
France
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019