Dear Chickeneers!
I might be stupid or blind, but I can't find a way of announcing foreign libraries to 'csc' that have to be linked to my binary. I have the following code:
(bind "int mosquitto_lib_init(void);")
(display (mosquitto_lib_init))
When doing 'csc mqtt.scm' on it, I get:
address@hidden chicken-ffi]$ csc mqtt.scm
mqtt.c: In function ‘stub30’:
mqtt.c:27:8: warning: implicit declaration of function ‘mosquitto_lib_init’ [-Wimplicit-function-declaration]
return(mosquitto_lib_init());
mqtt.c:24:54: note: in definition of macro ‘return’
#define return(x) C_cblock C_r = (C_int_to_num(&C_a,(x))); goto C_ret; C_cblockend
/usr/bin/ld: mqtt.o: in function `f_154':
mqtt.c:(.text+0x611): undefined reference to `mosquitto_lib_init'
collect2: error: ld returned 1 exit status
Error: shell command terminated with non-zero exit status 256: 'gcc' 'mqtt.o' -o 'mqtt' -L/usr/lib -Wl,-R/usr/lib -lchicken -lm -ldl
Understandably. Since I didn't link libmosquitto.so to it. But HOW?! I tried '-lmosquitto', but that's not passed on to gcc. Which is the correct way?