HI,

I am trying to load newly made PHP extension module (C++).
(e.g. mymodule.dll) using dl().

Only 20 days ago, I didn't meet this message.

With the same Source files and Makefile, I tried to make my

module, but I couldn't make it.

With same module, In linux, solaris I could make my module.

and it works well.

But in HP after compiler patch( especially 'ld' ) it haven't

worked well.



My history is like this

1. 20 days ago

I made my php-module, and it was successful.

It works well.
(in fact my colleage did this work )

2. 17 days ago

I tried to make another program with C++ , but I met

g++ Compiler Error , so I did patch my compiler.

After that I could make my another module.

3. 10 days ago

I needed to do patch my first module.
First I did backup previous module.
After that I made patch module.

At that time I met this message.

Invalid Library (Maybe not a PHP Library) mymodule.sl

at this time, I thought I had mistake.

so i restored my previous module.

4. 2 days ago

I asked my colleage to compile this module.

( I thought he could , so we didn't backup )

But it failed.

We met this terrible message - 'Invalid Library (Maybe not a PHP
Library)'

I am sure We have had the same Makefile , and php interface.

5. today I visited Php.net and I could get the 'first module'

after that I did compile - this process is successful.

But...but I met same message. -_-




what's wrong with our module?

Does Compiler Bug makes this problem?

Please Help me.





Reproduce code:
--------------- 
/* include standard header */
#include "php.h"

/* declaration of functions to be exported */
ZEND_FUNCTION(first_module);

/* compiled function list so Zend knows what's in this module */
zend_function_entry firstmod_functions[] =
{
ZEND_FE(first_module, NULL)
{NULL, NULL, NULL}
};

/* compiled module information */
zend_module_entry firstmod_module_entry =
{
STANDARD_MODULE_HEADER,
"First Module",
firstmod_functions,
NULL,
NULL,
NULL,
NULL,
NULL,
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};

/* implement standard "stub" routine to introduce ourselves to Zend */
#if COMPILE_DL_FIRST_MODULE
ZEND_GET_MODULE(firstmod)
#endif

/* implement function that is meant to be made available to PHP */
ZEND_FUNCTION(first_module)
{
long parameter;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
&parameter) == FAILURE) {
return;
}

RETURN_LONG(parameter);
}


cc -fPIC -DPIC -DCOMPILE_DL=1 -I/usr/local/include -I. -I.. -I../Zend
-c -o <your_object_file> <your_c_file>

Linking cc -shared -L/usr/local/lib -o <your_module_file>
<your_object_file(s)>


In HP-ux with gcc -rdynamic option is invalild.

Reply via email to