delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/06/08:26:40

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
To: cygwin AT cygwin DOT com
From: Jani Tiainen <redetin AT luukku DOT com>
Subject: Re: Building plugin that is used from multiple executables
Date: Wed, 06 Oct 2004 15:26:04 +0300
Lines: 59
Message-ID: <ck0o9b$i39$1@sea.gmane.org>
References: <1529c46304100604132bced4d1 AT mail DOT gmail DOT com>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: 195.236.144.25
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
In-Reply-To: <1529c46304100604132bced4d1@mail.gmail.com>
X-IsSubscribed: yes

Maarten Boekhold wrote:
> Hi,
> 
> Suppose I have a plugin library that contains calls that reside in the
> executable that dlopen()'s that plugin. You can link such a plugin by
> using a .def file that contains something like:
> 
> IMPORTS
> symbol = executable.exe.symbol
> 
> Now if I need to be able to use the *same* plugin from *two*
> executables, how do I resolve that??? Can I use a .def file that
> contains:
> 
> IMPORTS
> symbol = executable_1.exe.symbol
> symbol = executable_2.exe.symbol
> 
> My gut feeling says 'no', but hope against hope...

Well, shortly... You can't do that. Since windows exports are binded to 
name of library (application) and symbol...

Long way: You can do it, but you need to take alternative route.

You need one extra DLL that has imports symbol from executable and 
ex-exports symbol you need forward to plugin:

for plugin you need to do following:

IMPORT
symbol = helper.dll.symbol

and for both apps you create own helper.dll:

app1.exe create helper.dll:
IMPORT
symbol = app1.exe.symbol

EXPORT
symbol

app2.exe create helper.dll:
IMPORT
symbol = app2.exe.symbol

EXPORT
symbol

And finally...

Or even better, DTRT in windoze world is to pass needed symbol pointers 
as arguments to plugin function, since windows libraries and 
applications doesn't allow unresolved symbols in linktime (so called 
backlinking issue)...

-- 

Jani Tiainen


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019