ok, you're right I must post some code, this is what I have:
I need to pass this code from a regular c++ code to a php invoked .so library, this is the original code, which I need to translate in order to make my .so extension:
bool _stdcall Gauss(int n,double *mat, double *x)
{
int i,j,z;
double aux, pivote;
for (i=0;i<n;++i){
pivote = mat[i*(1+n) + i];
for (j=i;j<n+1;++j)
mat[i*(1 + n) + j] = mat[i*(1 + n) + j] / pivote;
for (z=0;z<n;++z){
if (z!=i){
aux = mat[z*(1+n) + i];
for (j=i;j<n+1;++j)
mat[z*(1+n) + j] = mat[z*(1+n) + j] - (aux * mat[i*(1+n) + j]);
}
}
}
for (i=0;i<n;++i){
x[i] = mat[i*(1+n) + n];
}
return true;
}
this was created for a windows dll but the application needs to be migrated to lunux, this should be, as far as I know the format to pass that function to a linux dinamic library:
[php]
#include "/usr/local/src/php-5.1.6/main/php.h"
PHP_FUNCTION(test);
static function_entry firstmod_functions[] = {
PHP_FE(test,NULL)
{NULL, NULL, NULL}
};
/* compiled module information */
zend_module_entry firstmod_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"test", // Extension name
firstmod_functions,
NULL,
NULL,
NULL,
NULL,
NULL,
#if ZEND_MODULE_API_NO >= 20010901
"0.1",
#endif
STANDARD_MODULE_PROPERTIES
};
ZEND_GET_MODULE(firstmod)
PHP_FUNCTION(test){
zval *mat
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &mat) == FAILURE) {
RETURN_STRING("No sirve con arrya",1);
}
else{
// do whatever I must do with the array, and here's where my problem is
RETURN_STRING("funciona con array",1);
}
}
[/php]
I hope I made myself clear enough, and pardon my english I'm actually not from the states or anywhere near any english speaking country.