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 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: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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 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/