Lisp HUG Maillist Archive

C Function pointers in FLI

Hi

Suppose you have something like

typedef struct _foo {
	int (* fPtr)(int foo, double **result);
} foo;

How would you render it in FLI?

Thanks

Marco

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Re: C Function pointers in FLI

Marco Antoniotti wrote:
> Suppose you have something like
> 
> typedef struct _foo {
> 	int (* fPtr)(int foo, double **result);
> } foo;
> 
> How would you render it in FLI?

Perhaps there's an undocumented way that is better than the FLI 4.3
manual. But reading that manual, the best I can come up with is:

(fli:define-c-struct foo
  (f-ptr (:pointer :void)))

Do you need to call the C function pointed to you by fPtr? I'm not
sure any CL implementations allow the calling of a function pointed to
by an address. The only ways I've seen to setup a C call is via macro
which is based on the name of the function rather than its address.
If you need to do this, perhaps you can write some C glue which takes
the fPtr address as well as the actual arguments of the function.

-- 
Kevin Rosenberg
kevin@rosenberg.net


Re: C Function pointers in FLI

Hi,

search the FLI manual for FLI:DEFINE-FOREIGN-FUNCALLABLE. There is also 
a sample.

Regards
Plamen

Marco Antoniotti wrote:
> Hi
> 
> Suppose you have something like
> 
> typedef struct _foo {
>     int (* fPtr)(int foo, double **result);
> } foo;
> 
> How would you render it in FLI?
> 
> Thanks
> 
> Marco
> 
> -- 
> Marco Antoniotti
> NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
> 715 Broadway 10th FL                fax. +1 - 212 - 998 3484
> New York, NY, 10003, U.S.A.
> 
> 



Re: C Function pointers in FLI

On Friday, Nov 7, 2003, at 16:02 America/New_York, plamen wrote:

> Hi,
>
> search the FLI manual for FLI:DEFINE-FOREIGN-FUNCALLABLE. There is 
> also a sample.

Thanks, it looks almost what I need.  This is only in 4.3 isn't it?  I 
could not find it in the 4.2.x docs.

Marco

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Re: C Function pointers in FLI

Unable to parse email body. Email id is 1523

Re: C Function pointers in FLI

On Friday 07 November 2003 04:56 pm, Marco Antoniotti wrote:
> On Friday, Nov 7, 2003, at 16:02 America/New_York, plamen wrote:
> > Hi,
> >
> > search the FLI manual for FLI:DEFINE-FOREIGN-FUNCALLABLE. There is
> > also a sample.
>
> Thanks, it looks almost what I need.  This is only in 4.3 isn't it?  I
> could not find it in the 4.2.x docs.

This sure sounds familiar (for 4.2.7), but I haven't found a piece of my 
source using it, yet.  Just go ahead and try it.

pt


Updated at: 2020-12-10 08:59 UTC