[Ecls-list] Segmentation fault in c-inline code question

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Tue Dec 16 17:09:42 UTC 2008

On Tue, Dec 16, 2008 at 5:50 PM, Erik Winkels <aerique at xs4all.nl> wrote:
> Where should I look for what's causing the problem if a piece
> of C code within a c-inline form segfaults while the same code
> works directly from a C program?

Sorry, but there is no generic answer. Normally this would be due to
an improper interaction of 1) headers, 2) libraries, 3) functions
defined in ECL and functions defined in your library.

> In all cases the debugger reports line 108 in the following
> fragment to be the cuplrit (this if for an ECL compiled with the --with-cxx switch):
>    106       void
>    107       construct(pointer __p, const _Tp& __val)
>    108       { ::new((void *)__p) _Tp(__val); }
> Is this ECL which somehow limits what the external library
> can do with regards to allocating memory?

Not explicitely. The garbage collector is know to coexist well with
other allocation schemes. However, it may be the case that the
Boehm-Weiser garbage collector is built with a replacement for C++'s
new operator, or that different components of your library are calling
different allocation routines -- for instance inlined code calling
Boehm-Weiser's malloc, while the stdc++ library calls its own
allocator --. Have you tried linking against a debug version of the
stdc++ library?


Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28009 (Spain)

More information about the ecl-devel mailing list