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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 5, 2010 at 4:38 PM, Eric Fowler <eric.fowler@xxxxxxxxx> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux