rjhdby
07/02/2018, 11:10 AMkotlinc -opt ./hellokt.kt -o hellokt -produce dynamic
kotlinc -opt ./hellokt.kt -o hellokt -produce static
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?olonho
07/02/2018, 2:00 PMrjhdby
07/02/2018, 2:05 PM(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 occuredrjhdby
07/02/2018, 2:07 PM-p dynamic
(libhellokt.so
) - extension work normallyrjhdby
07/02/2018, 2:08 PMolonho
07/02/2018, 3:21 PMinitRuntimeIfNeeded
call before calling Kotlin functionality, i.e. just before println?rjhdby
07/03/2018, 7:31 AMfun kt_print(string: String) {
konan.initRuntimeIfNeeded()
println("Hello, $string!!!")
}
rjhdby
07/03/2018, 7:39 AMrjhdby
07/03/2018, 9:03 AM