linking with static .lib

Larry Hall cygwin-lh@cygwin.com
Thu Feb 12 04:33:00 GMT 2004


At 09:27 PM 2/11/2004, Vikram Shrowty you wrote:
>Hi,
>   I have a windows static .lib that I want to use in a cygwin program.
>   Now, since 
>the .lib requires the microsoft c-runtime, I cant directly link it into
>my cygwin program. So I thought I'd make a dll out of it that is linked
>with the microsoft
>c-runtime and then link with the import lib of that dll.
>   So I did this to try and create the dll:
>%gcc -mno-cygwin -shared -o mydll.dll -Wl,--export-all-symbols
>-Wl,--whole-archive windows_static.lib Wl,--no-whole-archive
>
>But im getting these errors:
>fu000001.o(.idata$3+0xc): undefined reference to `_libmsvcrt_a_iname'
>fu000002.o(.idata$3+0xc): undefined reference to `_libmsvcrt_a_iname'
>fu000003.o(.idata$3+0xc): undefined reference to `_libmsvcrt_a_iname'
>fu000004.o(.idata$3+0xc): undefined reference to `_libmsvcrt_a_iname'
>fu000005.o(.idata$3+0xc): undefined reference to `_libmsvcrt_a_iname'
>fu000006.o(.idata$3+0xc): more undefined references to
>`_libmsvcrt_a_iname' follow
>nmth000000.o(.idata$4+0x0): undefined reference to `__nm___pctype'
>nmth000014.o(.idata$4+0x0): undefined reference to `__nm____mb_cur_max'
>nmth000028.o(.idata$4+0x0): undefined reference to `__nm___iob'
>
>And these warnings:
>Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
>Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
>Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
>Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
>Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
>.
>.
>many more of these.
>
>
>
>First of all, am I going down the right path in linking to the lib? 


No, not at all unfortunately.  Doing this doesn't get you around your 
initial stated concern, which is a valid one, of linking MSVCRT.  You'll
either need to remove the dependency in the library code itself or forgo
using the library.  There's a slim chance you'd get lucky and squeak by
with both MSVCRT and cygwin1.dll in the same code but if you don't know
what you're doing, the likelihood of success for this is minimal.  I 
can't recommend it.


>And
>if so, what am
>I doing wrong.


I guess, in a nutshell, you're starting from a faulty premise as I 
explained above.  The rest of what you see is just fallout from that
first mistep.

Sorry I don't have better news for you.


--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746                     


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list