[Gambas-user] external function again :)

Doriano Blengino doriano.blengino at ...1909...
Wed Feb 4 19:58:13 CET 2009


Wally ha scritto:
> I'm trying to access the GNU Scientific libray and have 
> a problem with math constants from this lib. 
> The power-functions are working nice.
>
> I try to build the above C-code in gambas and get the 
> error-message :
> Cannot find symbol 'M_PI_4' in dynamic library 'libgsl'
>   
Actually 'M_PI_4' seems to be a #define in C (because is all upeprcase), 
and so it is not exported.
Open gsl_math.h and look at its value, then define a constant in your 
gambas class, like Jussi suggested.

Moreover, in the C fragment M_PI_4 is *not* invoked with parentheses, so 
you can't expect you can do it! :-)

Cheers,
Doriano.

> These math constants should be available in libgsl and also 
> in libc  via math.h, but i can't get it to work.
> Where is my mistake ?
>
>
> ' ###########################################################
> ' #include < stdio.h >
> ' #include < gsl / gsl_math.h >
> '      
> ' Int main(void)
> ' {
> '    double a;
> '    double d = 5.0;
> ' 
> '    a = gsl_pow_2(d) * M_PI_4;
> ' 
> '    printf("Kreisflaeche = %f\n", a);
> '    RETURN 0;
> ' }
> '###########################################################
>
> ' Gambas class file
>
> EXTERN gsl_pow_2(a AS Float) AS Float IN "libgsl"
> EXTERN gsl_pow_int(a AS Float, b AS Integer) AS Float IN "libgsl"
> EXTERN M_PI_4() AS Float IN "libgsl"
>
> PUBLIC SUB Button1_Click()
>
>   TextArea1.Text = gsl_pow_2(5) & "\n"
>   TextArea1.Text &= gsl_pow_int(5, 3) & "\n"
>   TextArea1.Text &= M_PI_4()
>
> END
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>   





More information about the User mailing list