[PD] OSX lib loading: here we go again!

james tittle tigital at mac.com
Tue Jun 28 20:04:06 CEST 2005


...this may sound a bit like deja-vu, but hear me out:  It seems we  
need to change the s_loader.c stuff for OSX again!

...it all started recently when I was trying to compile pix_2pdp/ 
gem2pdp/pdp2gem with my newly upgraded xcode 2.1 tools and osx  
10.4.1...all of a sudden, there were old problems creeping up with  
undefined symbols, and after playing with it last night and browsing  
docs, I began to wonder if there was another way...

...so I decided to go back to the source:  s_loader.c...in it, osx is  
using NSLoadModule()...looking this up in current documentation, ya  
get the following good news:

Object File Image Functions

These functions are for loading Mach-O bundle files. They are  
declared in /usr/include/mach-o/dyld.h. The use of these functions is  
discouraged. You should use the more efficient functions described in  
“Dynamic Loader Compatibility Functions”.


...then, you go to the recommended docs, and behold:

Dynamic Loader Compatibility Functions

These are the recommended functions to use to interact with the  
dynamic loader. These functions work in Mac OS X v10.3 and v10.4.  
However, in Mac OS X v10.4 they are more efficient that other image- 
loading functions. These functions are declared in /usr/include/dlfcn.h.

...these are the typical dlopen/dlclose/dlwhatever functions, so, it  
appears osx has caught up to linux :-)

...There are of course many questions that'll have to be addressed  
over the next few days:  the most important would be "will currently  
compiled externals be loadable "as is" if we switch to the new  
dynamic loaders?", but I won't know until I go ahead and switch over  
the code and try, which'll I try when I get home tonight...

more l8r,
jamie

ps:  any other views?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20050628/ebdee279/attachment.htm>


More information about the Pd-list mailing list