[Top][All Lists]

[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


   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



   mosquitto.h exists in usr\include (The documentation can be found
   at [1]

   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


   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

   file not found

   :5: open-lib failed



   $76947B04 throw

   $769699D0 c(abort")

   $76969E98 compile-wrapper-function1



   As expected, ‘mosquitto_lib_init’ also fails.




   libcc.fs:534: failed assertion

   :9: assertion failed



   $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.o,
     * mosquitto.lo, and
     * mosquitto.c

   and ‘/home/pi/.gforth/libcc-named/.libs’ contains:
     * mosquitto.lai,
     * mosquitto.a, and
     * mosquitto.o

   Any idea?

   Thank you for your help.


   Envoyé de mon iPad

     Le 28 sept. 2023 à 22:17, Bernd Paysan <> 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

   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
   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
   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
   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*



reply via email to

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