From: fireblade
Subject: LW FLI :how to call c function with  float arguments ?
Date: 
Message-ID: <1140439936.588099.265690@z14g2000cwz.googlegroups.com>
If there is a function
// c
float c_add_floats( floar x , float y)
{
  return x + y;
}
 why does this doesn't work
; lisp LW 4.4.6 for Win
(fli:define-foreign-function     (c-add-floats "c_add_floats" )
    ((x :lisp-float)
     (y :lisp-float))  :result-type :float )

could anybody point me to some code 
thanks
bobi

From: Edi Weitz
Subject: Re: LW FLI :how to call c function with  float arguments ?
Date: 
Message-ID: <ufyme1897.fsf@agharta.de>
On 20 Feb 2006 04:52:16 -0800, "fireblade" <········@YAHOO.COM> wrote:

> If there is a function
> // c
> float c_add_floats( floar x , float y)
> {
>   return x + y;
> }
>  why does this doesn't work
> ; lisp LW 4.4.6 for Win
> (fli:define-foreign-function     (c-add-floats "c_add_floats" )
>     ((x :lisp-float)
>      (y :lisp-float))  :result-type :float )
>
> could anybody point me to some code 

Try to add

  :LANGUAGE :ANSI-C

to the function definition and see if it makes a difference.

  <http://article.gmane.org/gmane.lisp.lispworks.general/3836>

BTW, you are more likely to get answers to implementation-specific
questions like this one on the LispWorks mailing list.

Cheers,
Edi.

-- 

European Common Lisp Meeting 2006: <http://weitz.de/eclm2006/>

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: fireblade
Subject: Re: LW FLI :how to call c function with float arguments ?
Date: 
Message-ID: <1140441950.505860.82770@g43g2000cwa.googlegroups.com>
Thanks Edi I'll try it .

*BTW, you are more likely to get answers to implementation-specific
*questions like this one on the LispWorks mailing list.

I tried posting using gmane but i can see it even if gmane authorizer
mail me that my post will be on after 10 min , it's something like 2
hours and nothing
From: Raffael Cavallaro
Subject: Re: LW FLI :how to call c function with float arguments ?
Date: 
Message-ID: <2006022014433175249-raffaelcavallaro@pasdespamsilvousplaitmaccom>
On 2006-02-20 08:25:50 -0500, "fireblade" <········@YAHOO.COM> said:

> I tried posting using gmane but i can see it even if gmane authorizer
> mail me that my post will be on after 10 min , it's something like 2
> hours and nothing

subscribe to the list itself:

<http://www.lispworks.com/support/lisp-hug.html>

has instructions.
From: fireblade
Subject: Re: LW FLI :how to call c function with float arguments ?
Date: 
Message-ID: <1140889034.404828.48730@u72g2000cwu.googlegroups.com>
Everything works like a dream with floats now,
i have to rewrite some parts where i used c++ for conversion
from double to float but it's ok .
From: Edi Weitz
Subject: Re: LW FLI :how to call c function with  float arguments ?
Date: 
Message-ID: <ubqx217zi.fsf@agharta.de>
On Mon, 20 Feb 2006 14:15:32 +0100, Edi Weitz <········@agharta.de> wrote:

> Try to add
>
>   :LANGUAGE :ANSI-C
>
> to the function definition and see if it makes a difference.

A bit hard to find but here it is:

  <http://www.lispworks.com/documentation/lw445/FLI/html/fli-6.htm>

  "The final keyword argument, :LANGUAGE, specifies which language the
   foreign function was written in.  In this case the example uses
   ANSI C.  The main effect of this keyword is to determine how
   single-floating point value are passed to the C function.  When
   :ANSI-C is specified single floats are passed through as
   single-floats, otherwise they are passed through as double floats."

Cheers,
Edi.

-- 

European Common Lisp Meeting 2006: <http://weitz.de/eclm2006/>

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: fireblade
Subject: Re: LW FLI :how to call c function with float arguments ?
Date: 
Message-ID: <1140442133.812202.250570@f14g2000cwb.googlegroups.com>
Well actually my code is in C++ but i specify c linkage to MSVS using
extern "C"
Anyway thanks  for the great advise
From: Edi Weitz
Subject: Re: LW FLI :how to call c function with float arguments ?
Date: 
Message-ID: <u3bie178b.fsf@agharta.de>
On 20 Feb 2006 05:28:53 -0800, "fireblade" <········@YAHOO.COM> wrote:

> Well actually my code is in C++ but i specify c linkage to MSVS
> using extern "C"

Should work, my code (see below) is also C++.

> Anyway thanks  for the great advise

You're welcome.  I only knew because I had exactly the same problem
two days ago and I had to dig the solution out of old lisp-hug
postings... :)

  <http://common-lisp.net/pipermail/rdnzl-devel/2006-February/000070.html>

Cheers,
Edi.

-- 

European Common Lisp Meeting 2006: <http://weitz.de/eclm2006/>

Real email: (replace (subseq ·········@agharta.de" 5) "edi")