Re: How to get a string from C library into PHP via SWIG?

From: Date: Wed, 06 Jan 2010 03:13:13 +0000
Subject: Re: How to get a string from C library into PHP via SWIG?
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-300841@lists.php.net to get a copy of this message
I will expose only one function, prototyped like the foo() example I described. cstring.i is not implemented for a PHP target (wah). I think I will go the shell approach. I have enough time in this already. Eric On Tue, Jan 5, 2010 at 6:26 PM, Nathan Nobbe <quickshiftin@gmail.com> wrote: > On Tue, Jan 5, 2010 at 4:38 PM, Eric Fowler <eric.fowler@gmail.com> wrote: >> >> A little more information: my crashes all relate to handling the char >> datatype. Floats and ints are happy. >> >> I suspect that a char type in PHP is not the same as a char type in C. >> But I am not sure at all. >> >> More recently I have used cmalloc.i to allocate arrays of chars and >> floats. The floats are happy, the chars crash upon allocation. > > neat, swig generates php extensions.  i wonder Eric, how much functionality > you intend to expose to php, a series of functions, classes?  from the > sounds of your earlier description i would imagine maybe one class or a > single set of functions to operate on a single string variable, with > additional parameters for metadata. > im curious, if youre sold on the generator, or if youre interested to just > try your hand writing an extension.  if youre strong w/ C you could probly > crank it out quickly.  another option would be to version the generated > (swig) C, and repair it by hand, putting those changes in a branch.  during > subsequent generations, you could merge the work from said branch and > iterate on that. > of course the other option is to figure out swig, lol.  anyways, is this C > of yours for a private project or is it something i could take a peak at; im > halfway curious what youre working w/. > o, and guess what, reading through the swig php page, i discovered you can > write php extensions 'in c++', by creating a thin C wrapper - wow, i had > never thought of that, lol. > -nathan

« previous php.general (#300841) next »