gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C library


From: Mario Beaulieu
Subject: C library
Date: Thu, 28 Sep 2023 14:00:34 -0400

Hi,

I'm trying to use a C library to handle mqtt messages from GForth. I use 
Mosquitto as a message broker (on a Raspberry Pi 3).

The header file for mosquito can be found here: 
https://mosquitto.org/api/files/mosquitto-h.html

I get the information about GForth’s C Interface from 
https://gforth.org/manual/C-Interface.html


At the moment, I'm struggling on the function ‘mosquitto_new’. More precisely, 
my issue is that this function returns a pointer to a struct (« Pointer to a 
struct mosquitto on success »), which I can't figure out how to code.

Here's my code:
*********
c-library libmosquitto

\c #include <sys/types.h>
\c #include <mosquitto.h>

c-function mosquitto_lib_init         mosquittoLibInit                     -- 
void
c-function mosquitto_connect      mosquittoConnect    a a n n -- void
c-function mosquitto_subscribe   mosquittoSubscribe  a n a a -- void
c-function mosquitto_loop             mosquittoLoop           a n n    -- void

c-function mosquitto_new   mosquittoNew a n void -- "What do I put here?"

end-c-library
*******

I get an « Invalid name argument » error for every type I try.

Note that I'm not a C programmer, so I might be struggling with something 
obvious.

Any help will be appreciated 

Thank you

Mario

Envoyé de mon iPad

reply via email to

[Prev in Thread] Current Thread [Next in Thread]