delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,T_TO_NO_BRKTS_FREEMAIL |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Date: | Fri, 14 May 2010 10:57:18 +0200 |
Message-ID: | <AANLkTimwNAqJBuPS6lvvx4SBdlTh49fDHvKtGfUjHQuk@mail.gmail.com> |
Subject: | Using main() from a shared library in Cygwin 1.7 |
From: | Ferenc Kovacs <derefer AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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 |
Hi, I have an application, which links with a shared library (fairly common situation :)). This shared library provides the main() function. This approach works well on Linux/Solaris machines, but on Cygwin 1.7 I get the following link error: /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../libcygwin.a(libcmain.o):(.text+0xa9): undefined reference to `_WinMain AT 16' I created my shared library with: g++ -c -fPIC main_in_shared.cpp g++ -shared -fPIC -o libmain_in_shared.dll.a main_in_shared.o And finally: g++ -fPIC -o app app.cpp libmain_in_shared.dll.a, which fails... Some additional info: CYGWIN_NT-6.0 EVD8D3859A6470 1.7.2(0.225/5/3) 2010-03-24 21:12 i686 Cygwin gcc version 4.3.4 20090804 (release) 1 (GCC) $ nm libmain_in_shared.dll.a | grep main 70b41270 T ___main 70b460d8 I __imp____main 70b41c40 T _cygwin_premain0 70b41c50 T _cygwin_premain1 70b41c60 T _cygwin_premain2 70b41c70 T _cygwin_premain3 70b410f0 T _main With static libraries it links fine, so I don't think that the order of the libraries (as I see the output of `g++ -v') matters here. Could somebody please explain what's going on here? I couldn't find anything really relevant after a few hours of Google-ing... Thanks in advance! Cheers, Ferenc -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |