From: Simon Wright <simon@pushface.org>
Subject: Re: pragma import (C, , ); -- import a constant value from C library
Date: Sat, 27 Oct 2012 00:06:06 +0100
Date: 2012-10-27T00:06:06+01:00 [thread overview]
Message-ID: <lyhapgrfz5.fsf@pushface.org> (raw)
In-Reply-To: c5fc4cd5-8948-40dd-9191-e79a4617ffd4@googlegroups.com
Enzo Guerra <enzoguerra1@gmail.com> writes:
> trying to import a constant value from C library (libgsl)
> but having no luck
>
> M_EULER : Long_Float;
> -- M_EULER, Euler's constant, \gamma
> pragma Import (C, M_EULER, "M_EULER");
>
> get error undefined reference to `M_EULER'
>
> would appreciate any help
I wonder if the C M_EULER is in fact a macro? If so, it doesn't exist in
the library as a symbol in its own right.
You might try defining it as a variable in C and importing that:
/* m_euler_definition.c */
#include <libgsl.h> /* wherever M_EULER's defined */
const double m_euler_for_gnat = M_EULER;
-- m_euler.ads
M_EULER : constant Long_Float; -- or Interfaces.C.double
pragma Import (C, "M_EULER", "m_euler_for_gnat");
and then when you build you'll need to include m_euler_definition.o.
next prev parent reply other threads:[~2012-10-26 23:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-26 22:45 pragma import (C, , ); -- import a constant value from C library Enzo Guerra
2012-10-26 23:06 ` Simon Wright [this message]
2012-10-27 7:15 ` Maciej Sobczak
2012-11-05 3:41 ` David Thompson
2012-10-27 7:40 ` Dmitry A. Kazakov
2012-10-27 8:15 ` Simon Wright
2012-10-27 8:19 ` Simon Wright
2012-10-27 8:47 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox