compiling PHP4 as DSO in HP-UX 11.x
| From: | Kwon, YongChul | Date: | Tue, 28 Nov 2000 08:04:41 +0000 |
| Subject: | compiling PHP4 as DSO in HP-UX 11.x | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39351@lists.php.net to get a copy of this message | ||
I suffered for 2 days about compiling PHP4 as apache DSO in HP-UX 11.x.
there were 2 problems.
first, HP-UX 11.x in 32bit mode and HP-UX 10.x has no dlopen interface.
(must use shl_XXX HP-UX native interface. HP-UX 11.x 64bit mode supports
dlopen interface rather than old HP-UX native interface)
second, shared library dependancy lists always cleared.
the first, I resolved by writing my own dlopen interface.
but the second, it drove me really crazy.
it because of the libtool contained in PHP package.
it clears all dependancy lists from libphp4.sl.
so my solutions were
1. write own dlopen interface
2. replace libtool with newly setuped and compiled libtool(libtool-1.3.15)
I attach simple dlopen interface(not full, just for PHP).
and I'll be very glad if these are commented in next PHP release..
I used HP-UX native C compiler.
the attached source code should be compiled by following steps.
1. save the source code as dl.c
2. /opt/ansic/bin/cc +Z dl.c -o dl.o (should be rellocatable)
3. /usr/ccs/bin/ld -b -o libdl.sl dl.o -L/usr/lib -ldld
4. copy libdl.sl into /usr/lib
-----CUT HERE-----
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <dl.h>
void *dlopen(const char *file,unsigned int mode)
{
shl_t ret = NULL;
ret =
shl_load(file,BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART|DYNAMIC_PATH,0L);
return (void *)ret;
}
int dlclose(void *handle)
{
return shl_unload((shl_t)handle);
}
void *dlsym(void *handle,const char *name)
{
void *ret = NULL;
int status = 0;
errno = 0;
status = shl_findsym((shl_t *)&handle,name,TYPE_PROCEDURE,&ret);
if ( status == -1 && errno == 0 )
status = shl_findsym((shl_t *)&handle,name,TYPE_DATA,&ret);
return (status == -1 ? NULL : ret);
}
char *dlerror(void)
{
return strerror(errno);
}
-----CUT HERE-----