unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Program that uses Guile crashes
@ 2002-11-29 20:36 Janos Blazi
  2002-11-30 13:32 ` Marius Vollmer
  0 siblings, 1 reply; 2+ messages in thread
From: Janos Blazi @ 2002-11-29 20:36 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

I have written a C++ program that crahses after some time. My data look like

struct gppoint {
  point *p;
  SCM update_func;
};

point is a C++ class and for the C++ part I use new and delete while Guile uses its own allocation function.
I also use new and delete in another part of my program for wxWindows data.

Can new and Guile's own allocation scheme coexist?

TIA,
Janos Blazi

[-- Attachment #2: Type: text/html, Size: 1265 bytes --]

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

* Re: Program that uses Guile crashes
  2002-11-29 20:36 Program that uses Guile crashes Janos Blazi
@ 2002-11-30 13:32 ` Marius Vollmer
  0 siblings, 0 replies; 2+ messages in thread
From: Marius Vollmer @ 2002-11-30 13:32 UTC (permalink / raw)
  Cc: guile-user

"Janos Blazi" <jblazi@gmx.de> writes:

> Can new and Guile's own allocation scheme coexist?

Yes, certainly.  However, Guile's allocation scheme is quite different
from new/delete or malloc/free.  You don't have to explicitely delete
or free a object, but you have to take care that the object is always
properly visible to Guile's garbage collector.  Objects on the C stack
and inside other Guile objects are automatically visible, but other
objects might not be.  For those, you have to call
scm_gc_protect_object and scm_gc_unprotect object at appropriate
times.  Or turn your structure into a smob.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2002-11-30 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-29 20:36 Program that uses Guile crashes Janos Blazi
2002-11-30 13:32 ` Marius Vollmer

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).