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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.