From: Daniel Skarda <0rfelyus@ucw.cz>
Cc: guile-devel@gnu.org
Subject: Re: What can I do to help? (conclusions)
Date: 10 Oct 2002 14:07:23 +0200 [thread overview]
Message-ID: <m065wazedg.fsf@hobitin.ucw.cz> (raw)
In-Reply-To: <878z19rl8r.fsf@alice.rotty.yi.org>
> > (or link them explicitely with libstdc++). For example you do not
> > have to link guile against libgtk to make guile-gtk modules work.
> >
> Yes, I know that. This is a completly different problem, though. It's
> not about the C++ standard lib(s), but about C++ features such as
> exceptions and RTTI that must be 'supported' by the main program
> (don't ask me for details, however).
If you want to _throw_ C++ exception through C code, than yes - libguile has to
be compiled using g++. But I do not think this is a good idea - because you
bypass Guile exception mechanism and you will not be able to catch C++
exceptions from scheme and vice versa.
Recipe I used in my app: wrap all C++ "glue" functions with try/catch and
translate C++ exceptions to Scheme. Also all C++ -> Scheme entries must be
handled and Scheme exceptions translated to C++.
I try to extract helper code from my app and create "libguile++" library, with
utilities that are necessary for Guile/C++ integration tasks.
> > But do not believe me, it is just a guess few minutes before midnight...
> > I have never loaded C++ modules to C program.
> >
> I don't since I know better ;-) The proof is left as an exercise to
> the reader: Just compile some c++ code (and do some exception stuff in
> it) into a guile module, and guile will crash on loading this module -
> same thing with s/guile/c-linked-app/g.
See the code attached bellow - I have not any problems (on Debian Linux,
that's it). So reader is confused and tomorow he is going to try some SGI/Sun
machines... :-)
0.
;--- Makefile: --------------------------------------------------------
.SUFFIXES: .lo .la
CXXFLAGS = $(shell guile-config compile)
LDFLAGS = $(shell guile-config link) -rpath $(shell pwd)
all: libfoo.la
libfoo.la: foo.lo
libtool --mode=link $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
%.lo: %.cc
libtool --mode=compile $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
clean:
-rm -rvf .libs *.lo *.la *.a *.so
;--- foo.cc -------------------------------------------------------------------
#include <libguile.h>
#include <stdlib.h>
static SCM
scm_foo (void)
try
{
if (random () & 1)
throw "Something very bad happened";
return scm_makfrom0str ("bar");
}
catch (const char* desc)
{
scm_misc_error ("foo", desc, SCM_EOL);
return SCM_UNSPECIFIED;
}
extern "C"
void
init_foo (void)
{
scm_c_define_gsubr ("foo", 0,0,0, scm_foo);
}
;--- foo.scm ----------------------------------------------------------
(define-module (foo)
:use-module (gtk-1.2 dynlink))
(merge-compiled-code "init_foo" "libfoo")
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2002-10-10 12:07 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-28 10:58 What can I do to help? Dr William Bland
2002-09-28 16:19 ` Han-Wen Nienhuys
2002-09-30 8:56 ` Dr William Bland
2002-09-30 10:57 ` Dale P. Smith
2002-09-30 11:47 ` Dr William Bland
2002-09-30 17:59 ` Han-Wen Nienhuys
2002-09-30 18:27 ` Dale P. Smith
2002-09-30 18:52 ` Neil Jerram
2002-09-30 19:22 ` Tom Lord
2002-09-30 18:30 ` Tom Lord
2002-09-30 22:49 ` Rob Browning
2002-10-01 2:56 ` Rob Browning
2002-10-13 16:50 ` Rob Browning
2002-10-19 11:34 ` Jeff Read
2002-09-30 18:38 ` Neil Jerram
2002-09-30 22:35 ` Derek Atkins
[not found] ` <warlord@MIT.EDU>
2002-09-30 23:33 ` gnucash
2002-09-30 23:49 ` Derek Atkins
2002-10-01 8:43 ` Han-Wen Nienhuys
2002-10-01 14:15 ` Derek Atkins
2002-10-01 15:00 ` Rob Browning
2002-10-02 16:40 ` Rob Browning
2002-10-02 23:15 ` Neil Jerram
2002-10-02 16:34 ` Rob Browning
2002-10-02 16:28 ` Rob Browning
2002-10-02 9:18 ` Martin Grabmueller
2002-09-30 16:13 ` Rob Browning
2002-09-30 18:39 ` Neil Jerram
2002-10-01 17:14 ` What can I do to help? (conclusions) Dr William Bland
2002-10-02 23:15 ` Neil Jerram
2002-10-03 17:14 ` Evan Prodromou
2002-10-04 10:01 ` Andreas Rottmann
2002-10-04 10:57 ` Clinton Ebadi
2002-10-04 12:26 ` Dale P. Smith
2002-10-04 13:29 ` rm
2002-10-04 16:14 ` Andreas Rottmann
2002-10-06 17:08 ` rm
2002-10-06 17:34 ` Andreas Rottmann
2002-10-06 23:23 ` Marius Vollmer
2002-10-07 4:03 ` Rob Browning
2002-10-08 16:31 ` Andreas Rottmann
2002-10-08 17:27 ` Andreas Rottmann
2002-10-08 20:05 ` Rob Browning
2002-10-08 20:55 ` Andreas Rottmann
2002-10-10 5:26 ` Rob Browning
2002-10-10 8:34 ` Andreas Rottmann
2002-10-08 21:28 ` Marius Vollmer
2002-10-07 9:00 ` Andreas Rottmann
2002-10-07 13:16 ` Marius Vollmer
2002-10-07 14:33 ` Guile CVS Build Problems (was: Re: What can I do to help? (conclusions)) Andreas Rottmann
2002-10-08 23:05 ` Marius Vollmer
2002-10-08 23:40 ` Rob Browning
2002-10-08 23:13 ` Marius Vollmer
2002-10-09 7:56 ` Andreas Rottmann
2002-10-09 15:30 ` Rob Browning
2002-10-09 17:25 ` Andreas Rottmann
2002-10-09 17:37 ` Andreas Rottmann
2002-10-09 20:18 ` Rob Browning
2002-10-09 20:43 ` Rob Browning
2002-10-09 21:17 ` Rob Browning
2002-10-09 21:39 ` Rob Browning
2002-10-07 22:32 ` What can I do to help? (conclusions) Rob Browning
2002-10-07 21:08 ` Daniel Skarda
[not found] ` <878z19rl8r.fsf@alice.rotty.yi.org>
2002-10-10 12:07 ` Daniel Skarda [this message]
2002-10-04 13:14 ` Evan Prodromou
2002-10-04 15:27 ` Rob Browning
2002-10-04 15:22 ` Rob Browning
2002-10-04 16:02 ` Dale P. Smith
2002-10-04 18:58 ` Neil Jerram
2002-10-04 19:26 ` Evan Prodromou
2002-10-04 19:48 ` Tom Lord
2002-10-06 8:46 ` Fast format (was Re: What can I do to help?) Daniel Skarda
2002-10-06 11:20 ` Han-Wen Nienhuys
2002-10-06 17:53 ` Daniel Skarda
2002-10-03 12:00 ` Debian packages (Re: " Daniel Skarda
2002-10-04 12:33 ` Evan Prodromou
2002-10-04 15:43 ` Rob Browning
2002-10-04 18:46 ` Daniel Skarda
2002-10-05 5:51 ` Rob Browning
2002-10-05 8:55 ` Neil Jerram
2002-10-06 8:31 ` Daniel Skarda
2002-10-06 8:51 ` Jorgen Schaefer
2002-10-06 11:21 ` Han-Wen Nienhuys
2002-10-03 18:10 ` What can I do to help? Marius Vollmer
2002-10-03 21:32 ` Neil Jerram
2002-10-03 22:24 ` Marius Vollmer
2002-10-04 18:48 ` guile-debugger (was Re: What can I do to help?) Neil Jerram
2002-10-04 21:26 ` Han-Wen Nienhuys
2002-10-05 9:03 ` Neil Jerram
2002-10-06 8:51 ` Daniel Skarda
2002-10-12 13:36 ` Marius Vollmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m065wazedg.fsf@hobitin.ucw.cz \
--to=0rfelyus@ucw.cz \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).