Created
May 21, 2013 04:04
-
-
Save cythrawll/5617412 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "php_sample.h" | |
#define CODEANGEL_NS "CodeAngel" | |
PHP_FUNCTION(sample_hello_world) | |
{ | |
php_printf("Hello World!\n"); | |
} | |
static const zend_function_entry php_sample_functions[] = { | |
ZEND_NS_NAMED_FE(CODEANGEL_NS, helloWorld, ZEND_FN(sample_hello_world), NULL) | |
PHP_FE_END | |
}; | |
zend_module_entry sample_module_entry = { | |
STANDARD_MODULE_HEADER, | |
PHP_SAMPLE_EXTNAME, | |
php_sample_functions, /* functions */ | |
NULL, /* MINIT */ | |
NULL, /* MSHUTDOWN */ | |
NULL, /* RINIT */ | |
NULL, /* RSHUTDOWN */ | |
NULL, /* MINFO */ | |
PHP_SAMPLE_EXTVER, | |
STANDARD_MODULE_PROPERTIES | |
}; | |
#ifdef COMPILE_DL_SAMPLE | |
ZEND_GET_MODULE(sample) | |
#endif |
had Derick help me a bit
ZEND_NS_RAW_FENTRY(CODEANGEL_NS, "helloWorld", ZEND_FN(sample_hello_world), NULL, 0)
works
seems ZEND_NS_NAMED_FE is borked.
Indeed it is: http://news.php.net/php.internals/67453
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when I:
I get:
with weird quotes around the function name. calling:
CodeAngel\helloWorld();
throws a function not found error.
using ZEND_NS_FE seems to work, but I wanted to use ZEND_NS_NAMED_FE to control the name of my functions.