[Ecls-list] How to wrap C++ classes using ECLs foreign function interface?
Matthew Mondor
mm_lists at pulsar-zone.net
Thu Jul 11 15:24:17 UTC 2013
On Thu, 11 Jul 2013 20:46:15 +0900
Dietrich Bollmann <dietrich at formgames.org> wrote:
> [An answer to my own posting - I hope this is helpful for others with
> similar problems]
>
> Hi,
>
> Here how I finally solved the problem and wrapped the C++ class (sorry for
> the long delay):
> [...]
That is pretty nice and clean, thanks for following-up this thread;
Perhaps a few reminders, if performance is an issue (it might not
matter, depending, and are not only addressed to you, but may also
serve in the mail archive under this thread):
- Functions might be faster than methods (although there also is the
concept of sealed classes, which could also help)
- MAKE-CUBE (or a variant) could potentially instanciate the object
without adding an implicit finalizer, with a corresponding WITH-CUBE
or WITH-OBJECT macro responsible for finalization in UNWIND-PROTECT.
If I remember the implicit finalization system may be slower
(probably a good idea to test instead of trusting my word on this).
WITH-* style macros are also a very common lispy interface, require
very few indentation and permit explicit, immediate finalization as
an option.
- Alternatively, instead of full finalization+delete/free in WITH-*/GC,
objects could potentially be finalized then cached as slab
allocators do; this will help if objects are complex and part of the
instanciation+initialization can be preserved.
--
Matt
More information about the ecl-devel
mailing list