I can't call a C function (internal) in an exported PHP function ! (like ftp extension for exemple)
I don't understand why, if anyone can help, please.....
Here are the sources files of my module :
php_test.c // Zend module definition files
php_php_test.h
testc.c // Non exported C functions
testc.h
Here is a sample of php_test.c :
// Return a string, Takes a string
PHP_FUNCTION(test)
{
char *szNomRepToGet;
int argc = ZEND_NUM_ARGS();
int szNomRepToGet_len;
if(zend_parse_parameters(argc TSRMLS_CC, "s", &szNomRepToGet, szNomRepToGet_len) == FAILURE)
{ return; }
char *value;
value = testcc(szNomRepToGet);
RETURN_STRING(value,1);
}
Here is a sample of testc.c
static char* testcc(char* toto); // defintion
char* testcc(char* toto)
{
stcRep StcRepTest;
/* INITIALISATION DE MA STRUCTURE */
StcRepTest.num = 1;
strcpy(StcRepTest.text, "toto");
/* TEST CONTENU STRUCTURE */
if(StcRepTest.num == 1)
{
// zend_printf("Bien vu, ta struct est déclarée");
char* testok = "ok";
return testok;
}
char* testnok = "nok";
return testnok;
}
Here is a sample of testc.h
typedef struct
{
int num;
char* text;
}stcRep;
static char* testcc(char* toto);
Thanks in advance, Rom1
...Reading : Building Custom PHP Extensions => Very Good Book !