For anybody that is working on getting PHP extensions built using
freepascal,
I have some gotchas you may want to know about.
The with strategy of avoiding porting the PHP header files into pascal,
I am building a .SO library
for linux so that my PHP binaries can link to it by using a quick and
dirty C wrapper to
get access to the pascal library.
One of my extensions that I am building in freepascal also uses
the {$L } linker command to include some c based object files into the
free pascal
shared library.
The trick to compiling the c based object files is to make sure that you
build
a special compile script that will include the -fPIC compile option when
building the object
files.
Normally, I can just run make on whatever c project and build the object
files,
but to link those object files into a freepascal library, you must also
make the object
files get position independent code or the linker inside
Lazarus/freepascal goes bonkers.
Just an FYI for anybody who comes across this post in history.
md
On 6/2/2013 7:04 AM, m...@rpzdesign.com wrote:
Ok:
After a night of dwelling on the problem, the easiest solution is to
create
your linux dynamic libraries as a standalone separate lib.so library
in free pascal
and then use C to create the php extension and link it to the
freepascal library.
Trying to keep up with all of the PHP headers is a real pain in the
ass so just
use the extension environment to wrap the Pascal library is the best way.
This is identical to the mysqli interface where the extension links in
the libmysqlclient.so.xx library
into the php binary.
Hope this helps anyone doing this sort of thing.
md
On 6/1/2013 6:45 PM, m...@rpzdesign.com wrote:
Anybody have an opinion about writing dynamic extensions for PHP in
free pascal?
The samples and discussion at:
http://community.freepascal.org/bboards/message?message_id=342130&forum_id=24082
Indicates PHPToolkit, but all of the definitions inside these file
are way out of date.
My current PHP version is 5.4.10 and the compiler directives deal
with 5.2.x at the highest.
And the API version is 2001xxxx while the current is 20100525 and
higher.
So either I have to inspect the header files in PHP to see what
changes have been made
and then do a bunch of testing on struct sizes so I have the header
files ported correctly.
And it also does not seem to handle 64 bit linux that well since
there are a lot of records with
Word sizes (16 bit) but I need unsigned long int values. (Cardinal)
So if anybody has done anything recent with this on a more recent
version of PHP, pass along
a shout out.
Thanks for any answer,
md
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal