Jump to content

Can PHP call a C functiont that reyurns a pointer to a structure (a linked list)


A.P.

Recommended Posts

Can PHP call a C functiont that reyurns a pointer to a structure (a linked list)?

 

I am a C programmer and am writing C functions to do database access. The results are converted into linked lists.

 

Currently the PHP programmers are writing their own SQL statements to directly access the datbase, but the intention is for all DB access to be done via the C libraries I am writing. Howver our PHP programmers do not know how to implement this, and I don;t know PHP!

I think you would need to return a "Resource" type and expore iterator functions to PHP.

E.g:

$handle = call_your_query( $input );
while( $row = get_data_row($handle) )
{
    // Echo data etc..
    //echo '';
}

 

Both call_query and get_data_row for example would be your functions and so the first function would return a resource which PHP supports and the second function would return an array which PHP supports.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.