Developing an extension

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
gerhard54
Forum Newbie
Posts: 7
Joined: Wed Aug 31, 2011 8:22 am

Developing an extension

Post by gerhard54 »

Hello to everybody!

I'm new to this forum, so forgive me if I picked the wrong one. But from the title it seems the best fit...

My problem:
I am currently migrating an extension I had written some years ago from Windows to Linux.
During testing / adapting I had (up to now) no problem loading the partially finished extension into PHP.
BUT: now I'm stuck! PHP refuses to load the extension:

gerhard@CentOS tcads]$ php -f tcads.php
PHP Warning: dl(): p�1: Unable to initialize module
Module compiled with module API=305, debug=0, thread-safety=0
PHP compiled with module API=20050922, debug=0, thread-safety=0
These options need to match in /home/gerhard/Source/php-5.1.6/ext/tcads/tcads.php on line 5


I cant make any sense out of it. Of course "305" doesn't match "20050922", but what couses module to compile withe "API=305"
As the chars between "dl():" and "Unable" on the second line are actually displayed as "?" in reverse video,
might there be some problem with memory allocation/overwriting?

What made me think of this, is that my extension links against a static library (written by my self).
This library seems to be OK, as other aplications that use it, work as expected.
But I can't be 100% sure, the problem isn't with the library, as I'm developing it along with the extension and I made small changes to it while debuging the extension. What would be the best approch to run PHP in an debugger?

May be this information will be helpfull:
OS: CentOS 5.6
PHP: 5.1.6
From phpinfo():
PHP API 20041225
PHP Extension 20050922
Zend Extension 220051025

What works:
I can build, compile and load int PHP an "empty" extension using ext_skel and my .def file.

Thanks in advance for an input!

Gerhard
gerhard54
Forum Newbie
Posts: 7
Joined: Wed Aug 31, 2011 8:22 am

Re: Developing an extension

Post by gerhard54 »

Mistery solved!

Be extremly carefull when using:

#pragma pack(1)

when writing en extension!

Gerhard
Post Reply