[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C library
|
From: |
Mario Beaulieu |
|
Subject: |
Re: C library |
|
Date: |
Thu, 5 Oct 2023 13:07:36 -0400 |
Hi,
I’m still working on a C interface to mosquitto using GForth 0.7.3 on a
Raspberry Pi 3, but I encounter a new problem.
To try to figure out the problem, I reduced the program to a minimum:
*******
c-library mosquitto
\c #include <mosquitto.h>
c-function mosquitto_lib_init mosquitto_lib_init -- n
end-c-library
*******
mosquitto.h exists in usr\include (The documentation can be found
at [1]https://mosquitto.org/api/files/mosquitto-h.html)
I start with the folder ‘/home/pi/.gforth/libcc-named’ empty. (I leave
/.libs there but delete all its files).
I get an error at end-c-library: ar: `u' modifier ignored since `D' is
the default (see `U') and
file not found :5: open-lib failed
Here's what I get when I run the program:
******
$ gforth
Gforth 0.7.3, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
ok
c-library mosquitto ok
\c #include <mosquitto.h> ok
c-function mosquitto_lib_init mosquitto_lib_init -- n ok
end-c-library ar: `u' modifier ignored since `D' is the default (see
`U')
file not found
:5: open-lib failed
end-c-library<<<
Backtrace:
$76947B04 throw
$769699D0 c(abort")
$76969E98 compile-wrapper-function1
ok
********
As expected, ‘mosquitto_lib_init’ also fails.
******
ok
mosquitto_lib_init
libcc.fs:534: failed assertion
:9: assertion failed
mosquitto_lib_init<<<
Backtrace:
$76947B04 throw
$7695E080 c(abort")
$769692D8 (end-assert)
$769694B4 c-source-file
$76969BF8 compile-wrapper-function
******
After execution, ‘/home/pi/.gforth/libcc-named’ contains:
* mosquitto.la,
* mosquitto.o,
* mosquitto.lo, and
* mosquitto.c
and ‘/home/pi/.gforth/libcc-named/.libs’ contains:
* mosquitto.lai,
* mosquitto.la,
* mosquitto.so.0.0.0,
* mosquitto.so.0,
* mosquitto.so,
* mosquitto.a, and
* mosquitto.o
Any idea?
Thank you for your help.
Mario
Envoyé de mon iPad
Le 28 sept. 2023 à 22:17, Bernd Paysan <bernd@net2o.de> a écrit :
Am Donnerstag, 28. September 2023, 20:00:34 CEST schrieb Mario
Beaulieu via
Gforth discussion and announcements:
c-function mosquitto_new mosquittoNew a n void -- "What do I put
here?"
This should be:
c-function mosquittoNew mosquitto_new s n a -- a
The order of names (Forth name first, C name second) matters, and for
the
paramenters: whatever address it is, it should be an a type, i.e.
whenever the
C programmer writes a * at the end of the type, it is an a. Unless of
course
if it is a const char *, i.e. a string, then it is more comfortable to
pass a
Forth string to C, and use the s type, so you can call
s" my id" 1 callback-object mosquittoNew
and the s type constructs a zero terminated C string out of that Forth
string.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*
https://net2o.de/
References
1. https://mosquitto.org/api/files/mosquitto-h.html
| [Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: C library,
Mario Beaulieu <=