# MAC OS X and DSOs

- Thread: https://externals.io/message/10262
- Original archive: https://news-web.php.net/php.internals/10262
- Started by Andi Gutmans on 2004-06-03T13:43:27+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10262 — Andi Gutmans — 2004-06-03T13:43:27+00:00

URL: https://externals.io/message/10262#10262

Hi guys,

There seem to be some problems with loading shared libraries on the MAC OS 
X platform. It seems that ./configure on MAC OS X defines HAVE_LIBDL in 
php_config.h which causes the following code in zend.h not to be used:
#elif defined(HAVE_MACH_O_DYLD_H)
# define DL_LOAD(libname)           zend_mh_bundle_load(libname)
# define DL_UNLOAD(handle)          zend_mh_bundle_unload(handle)
# define DL_FETCH_SYMBOL(h,s)       zend_mh_bundle_symbol(h,s)
# define DL_ERROR                   zend_mh_bundle_error
# define DL_HANDLE                  void *
# define ZEND_EXTENSIONS_SUPPORT    1

After testing this stuff quite a bit it seems that in order for DSO's to 
work correctly on MAC OS X they should be defined. I am thinking of 
changing the following code in zend.h:

#if defined(HAVE_LIBDL)

to

#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)

Anyone have additional insight on this?
Andi

---

## #10263 — Dan Kalowsky — 2004-06-03T16:21:05+00:00

URL: https://externals.io/message/10262#10263 · In reply to: #10262

This behavior is mostly likely a result of the changes to the included 
system libraries in 10.3.  The truth to the matter is now dlcompat is 
distributed with OS X (as of 10.3) so most of the library handling code 
Marko and I wrote probably is no longer necessary for future 
generations of OS X (please note this is untested).  It is necessary 
though for those running 10.2 (and earlier), and there do seem to be a 
great many of them still.

Looking at your change though, I don't believe it should cause much 
damage.



> Hi guys,
>
> There seem to be some problems with loading shared libraries on the 
> MAC OS X platform. It seems that ./configure on MAC OS X defines 
> HAVE_LIBDL in php_config.h which causes the following code in zend.h 
> not to be used:
> #elif defined(HAVE_MACH_O_DYLD_H)
> # define DL_LOAD(libname)           zend_mh_bundle_load(libname)
> # define DL_UNLOAD(handle)          zend_mh_bundle_unload(handle)
> # define DL_FETCH_SYMBOL(h,s)       zend_mh_bundle_symbol(h,s)
> # define DL_ERROR                   zend_mh_bundle_error
> # define DL_HANDLE                  void *
> # define ZEND_EXTENSIONS_SUPPORT    1
>
> After testing this stuff quite a bit it seems that in order for DSO's 
> to work correctly on MAC OS X they should be defined. I am thinking of 
> changing the following code in zend.h:
>
> #if defined(HAVE_LIBDL)
>
> to
>
> #if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)
>
> Anyone have additional insight on this?
> Andi
