delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/02/10/19:47:49

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <47AF9B04.295EAD85@dessent.net>
Date: Sun, 10 Feb 2008 16:47:00 -0800
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: extern keyword and dlls
References: <BAY112-W28AE51E3894A2B44C59C2DF6290 AT phx DOT gbl>
X-IsSubscribed: yes
Reply-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

masta uy wrote:

> I am in working on porting some code to cygwin but I am stuck. I need it to be compiled as a dll but gcc gives me a linking error.

In short, you have to declare num as __declspec(dllimport) if it refers
to a variable in another module.  See
<http://www.haible.de/bruno/woe32dll.html> for a thorough explanation of
all the differences between PE and ELF shared libraries, and the various
workarounds to cope with them.

> Interestingly, the code above does work on my ubuntu installation (ubuntu 7.10 gcc 4.1.3)

These are different platforms, and shared libraries work differently.

Brian

--
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