Your notes on debugging should help me out significantly. I had forgotten
about the :c-file and other switches. I'll also read up on the UFFI
interface and see if I can find where the bug lies. Thanks for the tips!


On Fri, Jun 20, 2014 at 5:47 PM, Waldek Hebisch <hebi...@math.uni.wroc.pl>
wrote:

> Andrew Lyon wrote:
> >
> > Hey everyone (again). Since my last email, I found what appears to be a
> > weird CFFI/ECL bug. This was the cause of the problem I reported earlier
> > today. It seems like the code in the function runs fine, but on return it
> > barfs a segfault:
> >
> > https://gist.github.com/orthecreedence/15dea89a0a7d591bba51
> >
> > Note that I ended up working around this problem using ffi:c-inline to
> set
> > the values in the struct manually, but I consider this an ugly fix that
> I'd
> > rather not have there.
> >
> > Any ideas on what's wrong? Thanks!
>
> Probably not the cause of your problem, but AFAICS you have wrong types
> in foreign calls: 'memset' needs 'size_t' as third (last) argument
> and you pass ':unsigned-char'.  Similarly 'htons' has unsigned short
> as argument. 'htonl' need 32-bit unsigned integer as argument
> and returns 32-bit unsigned integer.  On Windows 'long' gives
> right size, but on other systems long may be too big (long typically
> has 64-bits on non-Windows 64-bit systems).
>
> My method to debug such problem is to put Lisp source in a file and
> use :c-file :h-file :data-file keyword arguments to 'compile-file'
> to capture resulting C code.  Then I look at C code to check if
> it is right -- that should localize the problem to specific plase.
> Once you know problem spot you may trace what 'cffi:with-foreign-slots'
> is doing and what wnet wrong.
>
> Note: native ecl FFI is UFFI and it allows you to assign to foreign
> data.  So you may manually assign slots at UFFI level.  I did not
> use CFFI but probably its constructs are translated (macro-expanded)
> to native (UFFI for ecl) constructs.  In such case looking at UFFI
> translation you should be able to determine if ecl has bug in its
> implementation of UFFI or bug is in CFFI.
>
> --
>                               Waldek Hebisch
> hebi...@math.uni.wroc.pl
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> _______________________________________________
> Ecls-list mailing list
> Ecls-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to