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: <4163EA68.6030407@x-ray.at> Date: Wed, 06 Oct 2004 14:51:52 +0200 From: Reini Urban User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.8a3) Gecko/20040817 MIME-Version: 1.0 To: Jani Tiainen CC: cygwin AT cygwin DOT com Subject: Re: Building plugin that is used from multiple executables References: <1529c46304100604132bced4d1 AT mail DOT gmail DOT com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Jani Tiainen schrieb: > Maarten Boekhold wrote: >> 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)... hmm, stubs: (intermediate dll, which dlopen's dependent on various issues another dll. platform, release, required feature se: pro/basic, language) lazy linking: resolve at run-time. as soon as it will be added to ld. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ -- 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/