Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-ID: <3E28B110.9080303@kleckner.net> Date: Fri, 17 Jan 2003 17:42:40 -0800 From: Jim Kleckner User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3 X-Accept-Language: en-us MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: RESOLVED: Using gcc to build a DLL discovered and linked at runtime References: <20030117145817 DOT 95468 DOT qmail AT web20002 DOT mail DOT yahoo DOT com> <20030117160523 DOT GC4335 AT redhat DOT com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Christopher Faylor wrote: >On Fri, Jan 17, 2003 at 06:58:17AM -0800, Joshua Daniel Franklin wrote: > >>MIME-Version: 1.0 >>Content-Type: text/plain; charset=us-ascii >> >>References: <3E2753C9 DOT 4040008 AT kleckner DOT net>, <3E25A7EE DOT 7050109 AT kleckner DOT net> >> >>>After carefully inspecting the symbols from >>>generated dlls and dlls provided by TradeStation, >>>I found that symbols occurred with and without the >>>@decorations. e.g. PPI AT 4 and PPI. >>> >>>Adding -Wl,--add-stdcall-alias to the gcc line, >>>all worked fine. >>> >>>Could this generally be a requirement for dlls >>>that are opened at runtime in a fashion similar to >>>dlopen? If so, then some FAQ annotation would be >>>in order here: >>> http://www.cygwin.com/cygwin-ug-net/dll.html >>> >>I may be wrong (I'm not a GCC expert), but isn't that more >>of a gcc thing than a cygwin thing? >> >>I don't want to end up pasting the whole gcc manual into >>the "Using DLLs" page. It's really only intended to be a quick >>start for cygwin, not a comprehensive guide. >> > >Right. The --add-stdcall-alias option is also not something >that you just nonchantly add to the command line. It does not >belong in a general guide, except, perhaps as a q.v. > I defer to your judgement here. I would note that it took me a lot of digging to come up with the solution. One small hint to others might save them a boatload of time. Something like: "When programs discover and open a dll at runtime be sure to check that the symbols are generated in the form expected by the program. Take a look at the documentation for ld about the --add-stdcall-alias and --kill-at options that control whether the 'ordinal number' is output as part of the symbol or not." in this page: http://www.cygwin.com/cygwin-ug-net/dll.html I didn't find any information on this question by top-down inspection of the GCC manual which does not give much discussion of Windows-specific features. Instead it refers readers to cygwin where I suspect most seekers will travel. A site search of gcc.gnu.org yields nothing for add-stdcall-alias or kill-at. It appears that only the binutils package documentation for ld and dlltool mention it. For completeness, the suggestion for the binutils team would be to augment the documentation about these options for ld to include: `-k' `--kill-at' Specifies that when `dlltool' is creating the exports file it should not append the string `@ '. These numbers are called ordinal numbers and they represent another way of accessing the function in a DLL, other than by name. Append this text: When programs discover and open a dll at runtime be sure to check that the symbols are generated in the form with or without ordinals as expected by the program. Try this option or the --add-stdcall-alias option if dynamic loading fails at runtime. If some kind reader might forward this message to the binutils team's list, I would be grateful as I am not a member. Thanks - Jim -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/