delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/11/23:33:43

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Reply-To: Cygwin List <cygwin AT cygwin DOT com>
Message-Id: <6.0.1.1.0.20040211232713.039013e0@127.0.0.1>
X-Sender:
Date: Wed, 11 Feb 2004 23:32:14 -0500
To: "Vikram Shrowty" <vikramshrowty AT fastmail DOT fm>, cygwin AT cygwin DOT com
From: Larry Hall <cygwin-lh AT cygwin DOT com>
Subject: Re: linking with static .lib
In-Reply-To: <1076552858.4570.180903314@webmail.messagingengine.com>
References: <1076552858 DOT 4570 DOT 180903314 AT webmail DOT messagingengine DOT com>
Mime-Version: 1.0

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/

- Raw text -


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