[cffi-devel] Re: cffi/allegro crash

Surendra Singhi efuzzyone at netscape.net
Sun Dec 18 02:50:35 UTC 2005


Surendra Singhi <efuzzyone at netscape.net> writes:

> Hello,
>   Any allegro experts around? I wrote cffi bindings (Dec-15) for some functions in
> wxWidgets, the bindings work smoothly on clisp and lispworks.
>
> But they crash on allegro. Then I tried to write the allego bindings directly,
> but it still crashes.
>
OK, I debugged further and found out that my allegro bindings were incorrect
which was causing segmentation faults, but cffi bindings still seem to be
correct as they work on clisp and lispworks. 

If I have C header file containing declarations as

typedef void _cdecl (*ClosureFun)(void* _evt );
void ELJApp_InitializeC(ClosureFun closure, int _argc, char** _argv)
{
 closure(NULL);
.....
}

The incorrect allegro bindings which I wrote are: 

(ff:def-foreign-call (ELJApp_InitializeC "ELJApp_InitializeC")
    ((closure (* :void))
     (_argc :int fixnum)
    (_argv (* :void)))
  :returning :void)

(ff:defun-foreign-callable init-func ((evt (* :void)))
  (print "hello-world"))

(Eljapp_initializeC #'init-func 0 nil)

How do I fix these incorrect allegro bindings?

Thanks.

-- 
Surendra Singhi
http://www.public.asu.edu/~sksinghi/index.html

,----
| "War is Peace! Freedom is Slavery! Ignorance is Strength!"
|     -- Orwell, 1984, 1948
`----




More information about the cffi-devel mailing list