[sane-devel] Re: Darwin/MacOSX

Peter O'Gorman peter@pogma.com
Fri, 29 Nov 2002 23:48:30 +0900


On Friday, November 29, 2002, at 11:21  PM, Karl Heinz Kremer wrote:

> On Fri, Nov 29, 2002 at 03:15:21PM +0100, Henning Meier-Geinitz wrote:
>> Hi,
>>
>> On Thu, Nov 28, 2002 at 09:12:03PM +0900, Peter O'Gorman wrote:
>>> Note that a dlopen compatibility library is needed, I suggest using
>>> dlcompat <http://www.opendarwin.org/projects/dlcompat>, but I am a
>>> little biased :)
>>
>> That's the third version of how MacOS shared libraries are stored.
>> 1) libsane-something.so(.version)
>> 2) libsane-something.dylib.version
>> 3) (yours) libsane-something(.version).so
>>

libtool is pretty screwed :) So is apple's gcc.

Loadable modules on darwin should be linked with the -bundle flag to 
apple's gcc (I'll just call it cc from now), objects created in that 
manner may be loaded and unloaded using NSModule(3) and 
NSObjectFileImage(3) functions. Objects linked with the -dynamiclib 
option to cc may be loaded using NSAddLibrary, but can not be unloaded 
and there is more overhead in loading them, it is discouraged. It used 
to be the -install_name and -current_version flags to cc were accepted 
quietly by gcc 2.95, but with the move to 3.1 these are errors. libtool 
current has these changes, but it is otherwise broken on darwin/Mac OS 
X, so it would probably require patches anyway. All current versions of 
libtool on darwin will link loadable modules and name them 
libxyz.{version}.so if passed the -module flag, if not passed that 
flag, libtool will name the objects libxyz.{version}.dylib, as these 
are not meant to be dynamically loaded, rather used as input to the 
linker.

Darwin does not come with dl functions, that is why we wrote the 
dlcompat library currently used by fink darwinports and many other 
projects, it was written for projects which expected to be able to load 
and link against objects and which could not be easily patched to 
behave properly (think KDE here). It is not necessary for sane to do 
that.

If you think your version is dynamically loading those dylibs, and you 
do not have dlcompat installed, you are wrong (sorry), I think you will 
probably find (use otool -L) that they are all linked into the 
library/app, or you are magically linking against libdl.0.dylib 
somewhere.

Now, excuse me, baby appears to be screaming :-)

Peter