delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/07/23/17:43:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <a07c15f00807231443i3ce6b0c2qf82f305b78213761@mail.gmail.com>
Date: Wed, 23 Jul 2008 16:43:16 -0500
From: "Nathan Thern" <nthern AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: .s file causing problems when linking
In-Reply-To: <488678FD.1F211496@dessent.net>
MIME-Version: 1.0
References: <a07c15f00807221329k544d2079ia14421e724fe6fd AT mail DOT gmail DOT com> <48864AB5 DOT 6D177B25 AT dessent DOT net> <a07c15f00807221617o20061c0dy135f955181472469 AT mail DOT gmail DOT com> <488678FD DOT 1F211496 AT dessent DOT net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Tue, Jul 22, 2008 at 7:19 PM, Brian Dessent <brian AT dessent DOT net> wrote:
> Nathan Thern wrote:
>> I'm following the build instructions for generic x86 *nix, going under
>> the assumption that cygwin fits in that category. I believe the
> Cygwin can't change the fact that fundamentally these are different
> operating systems, so for example linking works differently as does the
> way symbols are declared at the assembler level.  Assembly is pretty
> much the antithesis of portability so you can't expect this to work
> without some porting.
I managed to get this part working.

>> That is precisely what I tried to do: create a dll from the same .o's
>> that created the .exe.
>
> But that's not really going to work.  You can't fake it like that.  What
> you're doing is creating another library.
...
> That might get the library to link, but at runtime it does *not* mean
> that prbfish.dll will call the routines in scheme.exe.  Rather,
> prbfish.dll will be created with a hardcoded reference to libfoo.dll and
> will fail to run if libfoo.dll is not present -- this fake library is
> not fake, it is a real library, and it duplicates code in scheme.exe so
> it's probably useless and broken.
I did not know this.

> Please read that link which has examples of how to actually export
> symbols from an .exe and link the dll that imports them.  If you have
> the luxury of linking the .exe first then you can skip all the .def file
> junk because you can simply create an import library for the .exe as a
> side effect of linking it (-Wl,--out-implib) and then use that when
> linking prbfish.dll.  The only reason you'd ever need a .def file in
> this case is if you have a circular dependency where you can't link one
> without the other.
> Brian

That sounds great. However, I can't get it to work:
"gcc -o scheme.exe *.o -Wl,--out-implib,scheme.dll.a" creates a
working scheme.exe, but silently doesn't create scheme.dll.a
and
"gcc -shared -o scheme.exe *.o -Wl,--out-implib,scheme.dll.a" creates
scheme.dll.a and creates a scheme.exe that dies with "-bash:
scheme.exe: Permission denied" upon invocation.

I'm moving forward by just running gcc twice, but what am I missing?

regards,
NT

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