I hope you're staying safe.
I have been experimenting with importing LibC functions, and ran into two problems so far, so I'm wondering why they occur and if there's a way to make them work properly.
1. atexit: invalid memory access at 0.
Code: Select all
; extern int atexit(void(*)(void));
ImportC ""
atexit(*f)
EndImport
Procedure f()
Beep_(800, 30)
EndProcedure
Debug atexit(@f())
2. assert: PureBasic.asm [15]: extrn assert error: reserved word used as symbol.
Code: Select all
; #define assert(x) if(x){}else _assert("x")
ImportC ""
assert(expression)
EndImport
Debug assert(Bool(2+2=4))
Can we even import C macros or interface with a void(*)(void) argument?
Thanks.