A.P. Posted February 8, 2007 Share Posted February 8, 2007 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! Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 8, 2007 Share Posted February 8, 2007 Why are you writing C Libraries for a PHP program? It seems like the PHP programmers should be making their library in PHP. I don't believe PHP can access C this way... Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted February 8, 2007 Share Posted February 8, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.