This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Initialisation with data from dll-libraries


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]