unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* How to initialize GNU guile in a C++ command line tool?
@ 2023-02-09 10:43 Basile Starynkevitch
  2023-02-09 11:18 ` Maxime Devos
  0 siblings, 1 reply; 2+ messages in thread
From: Basile Starynkevitch @ 2023-02-09 10:43 UTC (permalink / raw)
  To: guile-user; +Cc: STARYNKEVITCH Basile

Hello,


My platform is Linux Debian sid x86-64 or Linux Ubuntu 22.10 x86-64. 
Using package guile-3.0-dev (version 3.0.8-2).


I want to drive the Frama-C <https://frama-c.com/> static analyzer with 
a C++ driving program which uses (optionally) Guile to run Frama-C.

My current code (GPLv3+) in on github. Inside the small 
https://github.com/bstarynk/misc-basile/ repository (a small thing, 
containing various unrelated programs and scripts).

For the commit 
https://github.com/bstarynk/misc-basile/commit/6c478ca7cd2d43bc203d0f2b0881a0cdeabaf633 
when I uncomment the lines 501 and 805 there is a link failure.

My guile_has_been_initialized is my global boolean flag.


I coded:


     if (!guile_has_been_initialized)
         {
             guile_has_been_initialized=true;
#warning BUG here related to guile
             //scm_init_eval();


and the build is failing

+ /usr/bin/g++ -O -g -I/usr/include/guile/3.0 -pthread -rdynamic 
clever-framac.cc '-DGIT_ID="6c478ca7cd2d"' -ldl -lguile-3.0 -lgc 
-lpthread -ldl -o clever-framac
clever-framac.cc:500:2: warning: #warning BUG here related to guile [-Wcpp]
   500 | #warning BUG here related to guile
       |  ^~~~~~~
clever-framac.cc:503:2: warning: #warning do_evaluate_guile 
unimplemented [-Wcpp]
   503 | #warning do_evaluate_guile unimplemented
       |  ^~~~~~~
clever-framac.cc:720:2: warning: #warning unimplemented inner_guile [-Wcpp]
   720 | #warning unimplemented inner_guile
       |  ^~~~~~~
clever-framac.cc:726:2: warning: #warning unimplemented do_use_guile [-Wcpp]
   726 | #warning unimplemented do_use_guile
       |  ^~~~~~~
clever-framac.cc:804:2: warning: #warning BUG here related to guile [-Wcpp]
   804 | #warning BUG here related to guile
       |  ^~~~~~~
clever-framac.cc:807:2: warning: #warning unimplemented use Guile here 
[-Wcpp]
   807 | #warning unimplemented use Guile here
       |  ^~~~~~~
/usr/bin/ld: /tmp/cc51HoPM.o: in function `do_evaluate_guile(char const*)':
/home/basile/misc-basile/clever-framac.cc:501: undefined reference to 
`scm_init_eval'
collect2: error: ld returned 1 exit status


Where is my mistake? Notice that -lguile-3.0 is linked!



Thanks for your help.



NB. I might borrow some code from GUILE into http://refpersys.org/


-- 
Basile Starynkevitch<basile@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to initialize GNU guile in a C++ command line tool?
  2023-02-09 10:43 How to initialize GNU guile in a C++ command line tool? Basile Starynkevitch
@ 2023-02-09 11:18 ` Maxime Devos
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Devos @ 2023-02-09 11:18 UTC (permalink / raw)
  To: Basile Starynkevitch, guile-user; +Cc: STARYNKEVITCH Basile


[-- Attachment #1.1.1: Type: text/plain, Size: 550 bytes --]



On 09-02-2023 11:43, Basile Starynkevitch wrote:
> /usr/bin/ld: /tmp/cc51HoPM.o: in function `do_evaluate_guile(char const*)':
> /home/basile/misc-basile/clever-framac.cc:501: undefined reference to 
> `scm_init_eval'
> collect2: error: ld returned 1 exit status

scm_init_eval is an internal thing:

libguile/eval.c:scm_init_eval ()
libguile/eval.h:SCM_INTERNAL void scm_init_eval (void);

Being internal, it is hidden by default.

Are you sure you meant to use scm_init_eval instead of scm_init?

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-09 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 10:43 How to initialize GNU guile in a C++ command line tool? Basile Starynkevitch
2023-02-09 11:18 ` Maxime Devos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).