Subject: Re: dll questions
From: [email-masked] (Gary V. Vaughan)

11 Nov 1998 18:39:10 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: "Stephen R. Whiteley" <[email-masked]>
Cc: [email-masked]

"Stephen R. Whiteley" wrote:
> 
> I'm new to Windows NT and Cygnus, but a long-time unix programmer.

Guilty on counts 1 and 3!

> I'm trying to port a unix application that has a separate shared
> library to NT via cygwin.  The problem is that the shared library
> calls functions in the main application, and I haven't figured out
> haw to link a dll that does this.

There are a few of us trying to get libtool to do the necessary magic
for this.  You might want to subscribe to
mailto:[email-masked] to see what develops.

> Questions:
>   Is it even possible for a dll to call functions in the main
> application?

Yes.  But it is tricky.
 
>   Is so how?

The crux of the problem is that the final link for a win32 dll *must*
resolve all of the symbols in the dll.

On the bug-libtool list, Ian Lance Taylor wrote:
>
> I doubt there is any wholly acceptable solution here.  The only
> workable one I can see would be to effectively enhance Windows and
> AIX shared libraries such that they support creating shared libraries
> with undefined symbols.  On Windows, this could be done by doing the
> link once, checking for undefined symbols, creating little stub
> routines for those symbols which track down the symbols in some other
> open DLL, compiling those stubs, and linking them into the DLL.
> Perhaps something similar is possible on AIX.
>
> Of course even that will not make Windows DLLs identical to ELF
> shared libraries.  ELF shared libraries permit the main program to
> override a symbol in the shared library, and Windows DLLs do not.

And dlopened libraries are a whole other kettle of fish...

>   Is there a man page or docs for dlltool, dllwrap?

Have a look for dllhelper on Mumit Khans ftp site... it has examples too
=)O|

Cheers,
	Gary V. Vaughan
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".