php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28332 Invalid Library (Maybe not a PHP Library)
Submitted: 2004-05-09 08:01 UTC Modified: 2004-05-09 12:39 UTC
From: kicom95 at daum dot net Assigned:
Status: Not a bug Package: Dynamic loading
PHP Version: 4.3.4 OS: HP-UX 11.11
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kicom95 at daum dot net
New email:
PHP Version: OS:

 

 [2004-05-09 08:01 UTC] kicom95 at daum dot net
Description:
------------
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.dll

   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.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-09 12:39 UTC] wez@php.net
This isn't a support forum.
Ask extension development questions on pecl-dev@lists.php.net.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC