delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <46703D2F.DF96EEA8@dessent.net> |
Date: | Wed, 13 Jun 2007 11:53:35 -0700 |
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: dll link error using Cygwin gcc |
References: | <000001c7adeb$04468a00$0cd39e00$@mills AT novaspeech DOT com> |
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 |
Harold Mills wrote: > As Dave Korn and Brian Dessent both pointed out, my problem was that gcc was > compiling Hello.c with the default cdecl calling convention, but the library > I wanted to link to uses the stdcall convention. Adding __stdcall to the > function declarations in the header file eci.h fixed the problem. Dave > suggested using the --enable-stdcall-fixup link option, which from the ld > documentation did seem like it would do the trick, but I couldn't get it to > work. I specified it to gcc as -Wl,--enable-stdcall-fixup, but still got the > "undefined reference" error message. The --enable-stdcall-fixup option is only useful in the situation where the compiler used the correct calling convention but for whatever reason the symbol decorations still don't match. Or in other words, no linker switch will ever be able to make the compiler switch between cdecl (caller pops) calling convention and stdcall (callee pops) calling convention. And even if you were somehow successful getting linking to work when the underlying calling convention was not correct, you'd get crashes or stack exhaustion or worse. 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |