realbasic-plugins
[Top] [All Lists]

Re: dylibs, function loading and getting the wrong one called

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: dylibs, function loading and getting the wrong one called
From: Jonathan Johnson <jonj at realsoftware dot com>
Date: Wed, 25 Oct 2006 10:32:42 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
References: <FF8466A2-36B7-4475-B1D8-3CAA6CDFEC1E at great-white-software dot com> <9098A1BD-4056-438C-938E-02FCCE3D16B5 at realsoftware dot com> <66EFC441-94D9-4A82-91DA-A3AB94F1A193 at great-white-software dot com>

On Oct 25, 2006, at 9:58 AM, Norman Palardy wrote:


On Oct 25, 2006, at 4:56 AM, Jonathan Johnson wrote:


On Oct 25, 2006, at 12:23 AM, Norman Palardy wrote:
OK ... so I put calls to each function in their own method (still in the same class) and see if that helps
Nope.

OK ... so take the two calls and put them in separate modules.
No luck.

After reading how dlopen and such work is this even possible using those functions ? And, since plugins contain dylibs how is this avoided if two plugins have the same signature for a function ?

Depending on how you created your dylibs, you may not have two- level namespaces enabled. This would be the first thing to look at.

Where in XCode is that setting ?
I can't seem to find it.

In Xcode 2.4... actually, nevermind. It appears that it's no longer obvious how to turn this feature off, so you probably have it on (which it is by default).

I did find lots of message between you and Chris Espinosa about this but darned if I could find the setting :)

Well, here's the issue. It turns out this is the problem. We use NSAddImage and NSLookupSymbolInImage because dyld isn't available in anything prior to 10.3. NSAddImage has no notion of adding an image to a private namespace, even if two level namespaces are used. So, whichever library loads the symbol first will be used for the rest of the run.

We can use dyld on 10.3 and higher though, so if possible, please file a report against this. One workaround might be to package the dylib into a bundle and declare against the bundle. This should work.

HTH,
Jon


--
Jonathan Johnson
jonj at realsoftware dot com
REAL Software, Inc.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>