2004-03-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>

* how-programming.texinfo: Make list in .lib FAQ enumerative.
This commit is contained in:
Joshua Daniel Franklin 2004-03-29 06:37:40 +00:00
parent 4341a703f6
commit 680dacb164
2 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2004-03-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* how-programming.texinfo: Make list in .lib FAQ enumerative.
2004-03-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> 2004-03-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* how-programming.texinfo: Add note about gcc .lib linking. * how-programming.texinfo: Add note about gcc .lib linking.

View File

@ -208,23 +208,27 @@ If your @samp{.lib} file is a normal static or import library with
C-callable entry points, you can list @samp{foo.lib} as an object file for C-callable entry points, you can list @samp{foo.lib} as an object file for
gcc/g++, just like any @samp{*.o} file. Otherwise, here are some steps: gcc/g++, just like any @samp{*.o} file. Otherwise, here are some steps:
1. Build a C file with a function table. Put all functions you intend @enumerate
@item Build a C file with a function table. Put all functions you intend
to use in that table. This forces the linker to include all the object to use in that table. This forces the linker to include all the object
files from the .lib. Maybe there is an option to force LINK.EXE to files from the .lib. Maybe there is an option to force LINK.EXE to
include an object file. include an object file.
2. Build a dummy 'LibMain'. @item Build a dummy 'LibMain'.
3. Build a .def with all the exports you need. @item Build a .def with all the exports you need.
4. Link with your .lib using link.exe. @item Link with your .lib using link.exe.
@end enumerate
or or
1. Extract all the object files from the .lib using LIB.EXE. @enumerate
2. Build a dummy C file referencing all the functions you need, either @item Extract all the object files from the .lib using LIB.EXE.
with a direct call or through an initialized function pointer. @item Build a dummy C file referencing all the functions you need, either
3. Build a dummy LibMain. withth a direct call or through an initialized function pointer.
4. Link all the objects with this file+LibMain. @item Build a dummy LibMain.
5. Write a .def. @item Link all the objects with this file+LibMain.
6. Link. @item Write a .def.
@item Link.
@end enumerate
You can use these methods to use MSVC (and many other runtime libs) You can use these methods to use MSVC (and many other runtime libs)
with Cygwin development tools. with Cygwin development tools.