With shared library all working, but with static library I receive segfault.
Why it can be? Mabe I need to provide some specific keys to c compiler?
o
olonho
07/02/2018, 2:00 PM
could you please provide stacktrace of crash from debugger?
r
rjhdby
07/02/2018, 2:05 PM
Copy code
(gdb) run -dextension=./modules/hello.so -r "echo hello('JoE');"
Starting program: /opt/rh/rh-php71/root/usr/bin/php -dextension=./modules/hello.so -r "echo hello('JoE');"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00005555557b0682 in zend_register_functions ()
(gdb) bt
#0 0x00005555557b0682 in zend_register_functions ()
#1 0x00005555557b16b7 in zend_register_module_ex ()
#2 0x00005555556ecc36 in php_load_extension ()
#3 0x000055555579dace in zend_llist_apply ()
#4 0x000055555574f59a in php_ini_register_extensions ()
#5 0x0000555555747da9 in php_module_startup ()
#6 0x000055555584796d in php_cli_startup ()
#7 0x0000555555624838 in main ()
Library loaded on step
php_load_extension
and registered as module on step
zend_register_module_ex
.
Also, if I do not use any library function inside c code, then no crash occured