X-Spam-Check-By: sourceware.org Message-ID: <442FF2BB.10307@cygwin.com> Date: Sun, 02 Apr 2006 11:50:19 -0400 From: "Larry Hall (Cygwin)" Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051223 Fedora/1.5-0.2.fc4.remi Thunderbird/1.5 Mnenhy/0.7.3.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Initialisation with data from dll-libraries References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 Jørgen Steensgaard-Madsen wrote: > Asking for help. > > I am porting a tool to implement interpreters from Linux to > Windows/Cygwin, and have succeeded with a statically linked version. > Interpreters depend on several libraries and use a dispatch table > with pointers to functions from the libraries. The statically linked > port has been tested succesfully. > > With gcc it is possible to build dll-versions of the libraries > (i.e. pairs of cygXXX.dll and libXXX.dll.a). An application can be > built, if there is no dispatch table, but when I try to build an > interpreter the resulting dispatch table contains just null > references. > > The terminology related to dll is rather confusing to me as a novice > user of these. After having looked into various descriptions I am > left with a number of questions: > > . The following command (outline) has been used: > > $(CC) -o demo */glue.o dispatch.o \ > -Wl,--enable-auto-import \ > -Wl,--no-whole-archive $(LFLAGS) > > No error or warning arises, and the interpreter starts to ask > for input as expected, but the first attempt to use the > dispatch table leads to a segmentation fault. > > Am I missing some options here? > > . Will a *.def file be helpful (or: required) in order to have the > linker initialise the dispatch table correctly? > > . Must I use dlltool rather than just gcc to build the libraries > with enough information to get the dispatch table initialised? > > Please help me if you can. You haven't said where the dispatch table is or how it is supposed to filled in. Are you using dlopen/dlsym or is there another mechanism in play here to find the function pointers that are put into this table? If it's the former, I don't see an obvious reason why the pointers couldn't be filled in, unless the DLL with them cannot be found. But you should know if this is the case, unless you're not checking for errors returned. I can't imagine that a *.def file or direct utilization of dlltool would be helpful in your case, since these both allow references to be resolved at link time, which doesn't appear to be your issue at all. So I think you'll need to provide more details (perhaps a small example) of how what you're doing is supposed to work before more help can be given. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 838 Washington Street (508) 893-9889 - FAX Holliston, MA 01746 -- 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/