* -fdump-ada-spec: "FILE" not declared
@ 2020-04-07 17:10 hreba
2020-04-07 17:19 ` hreba
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: hreba @ 2020-04-07 17:10 UTC (permalink / raw)
Hi,
I am trying to generate Ada bindings for the GSL (Gnu Scientific
Library) odeiv2 package (ordinary differential equations). So I do the
following 2 steps:
1. Go to an empty directory "src" and execute
g++ -c -fdump-ada-spec -C /usr/include/gsl/gsl_odeiv2.h
2. Go to an empty directory "obj" and execute
gcc -c -gnat05 ../src/*.ads
Unfortunately, gsl_odeiv2.h includes stdio.h, and this leads to a series
of errors like
stdio_h.ads:117:69: "FILE" not declared in
"x86_64_linux_gnu_bits_types_FILE_h"
--
Frank Hrebabetzky, Kronach +49 / 9261 / 950 0565
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fdump-ada-spec: "FILE" not declared
2020-04-07 17:10 -fdump-ada-spec: "FILE" not declared hreba
@ 2020-04-07 17:19 ` hreba
2020-04-11 17:01 ` hreba
2020-04-07 19:29 ` Per Sandberg
2020-04-15 15:18 ` Luke A. Guest
2 siblings, 1 reply; 8+ messages in thread
From: hreba @ 2020-04-07 17:19 UTC (permalink / raw)
On 2020-04-07 19:10, hreba wrote:
> Hi,
> I am trying to generate Ada bindings for the GSL (Gnu Scientific
> Library) odeiv2 package (ordinary differential equations). So I do the
> following 2 steps:
> 1. Go to an empty directory "src" and execute
> g++ -c -fdump-ada-spec -C /usr/include/gsl/gsl_odeiv2.h
> 2. Go to an empty directory "obj" and execute
> gcc -c -gnat05 ../src/*.ads
> Unfortunately, gsl_odeiv2.h includes stdio.h, and this leads to a series
> of errors like
>
> stdio_h.ads:117:69: "FILE" not declared in
> "x86_64_linux_gnu_bits_types_FILE_h"
Excuse me, only part of the message was transmitted. Continuing:
"FILE" _is_ declared. stdio.h includes <bits/types/FILE.h>, the complete
content of which is
---------------------------------------------------------------------
#ifndef __FILE_defined
#define __FILE_defined 1
struct _IO_FILE;
/* The opaque type of streams. This is the definition used elsewhere. */
typedef struct _IO_FILE FILE;
#endif
----------------------------------------------------------------------
The definition of _IO_FILE I found in
/usr/include/x86_64-linux-gnu/bits/libio.h
but when I include this additionally, I get
# error "Never include <bits/libio.h> directly; use <stdio.h> instead."
Any idea?
--
Frank Hrebabetzky, Kronach +49 / 9261 / 950 0565
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fdump-ada-spec: "FILE" not declared
2020-04-07 17:19 ` hreba
@ 2020-04-11 17:01 ` hreba
2020-04-15 15:08 ` hreba
0 siblings, 1 reply; 8+ messages in thread
From: hreba @ 2020-04-11 17:01 UTC (permalink / raw)
Just to let you know that the problem has been solved after a hint on
stackoverflow: using -fdump-ada-spec-slim instead of -fdup-ada-spec one
gets only the Ada bindings of that .h file one asked for, and not those
of all included header files (recursively). Then one manually adds the
header files which one really needs. No need for a declaration of FILE
anymore.
--
Frank Hrebabetzky, Kronach +49 / 9261 / 950 0565
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fdump-ada-spec: "FILE" not declared
2020-04-11 17:01 ` hreba
@ 2020-04-15 15:08 ` hreba
0 siblings, 0 replies; 8+ messages in thread
From: hreba @ 2020-04-15 15:08 UTC (permalink / raw)
On 4/11/20 7:01 PM, hreba wrote:
> Just to let you know that the problem has been solved after a hint on
> stackoverflow: using -fdump-ada-spec-slim instead of -fdup-ada-spec one
> gets only the Ada bindings of that .h file one asked for, and not those
> of all included header files (recursively). Then one manually adds the
> header files which one really needs. No need for a declaration of FILE
> anymore.
The problem appeared again with other C files, but this time I found the
solution on the web. From Interfaces.C_Streams:
subtype FILEs is System.Address;
-- Corresponds to the C type FILE*
--
Frank Hrebabetzky, Kronach +49 / 9261 / 950 0565
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fdump-ada-spec: "FILE" not declared
2020-04-07 17:10 -fdump-ada-spec: "FILE" not declared hreba
2020-04-07 17:19 ` hreba
@ 2020-04-07 19:29 ` Per Sandberg
2020-04-08 16:13 ` hreba
2020-04-15 15:18 ` Luke A. Guest
2 siblings, 1 reply; 8+ messages in thread
From: Per Sandberg @ 2020-04-07 19:29 UTC (permalink / raw)
Hi
I recalled that i played with it some years ago so i just push:ed my
play to github.
Have a look on:
https://github.com/Ada-bindings-project/ada-gsl
/P
On 4/7/20 7:10 PM, hreba wrote:
> Hi,
> I am trying to generate Ada bindings for the GSL (Gnu Scientific
> Library) odeiv2 package (ordinary differential equations). So I do the
> following 2 steps:
> 1. Go to an empty directory "src" and execute
> g++ -c -fdump-ada-spec -C /usr/include/gsl/gsl_odeiv2.h
> 2. Go to an empty directory "obj" and execute
> gcc -c -gnat05 ../src/*.ads
> Unfortunately, gsl_odeiv2.h includes stdio.h, and this leads to a series
> of errors like
>
> stdio_h.ads:117:69: "FILE" not declared in
> "x86_64_linux_gnu_bits_types_FILE_h"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fdump-ada-spec: "FILE" not declared
2020-04-07 17:10 -fdump-ada-spec: "FILE" not declared hreba
2020-04-07 17:19 ` hreba
2020-04-07 19:29 ` Per Sandberg
@ 2020-04-15 15:18 ` Luke A. Guest
2 siblings, 0 replies; 8+ messages in thread
From: Luke A. Guest @ 2020-04-15 15:18 UTC (permalink / raw)
On 07/04/2020 18:10, hreba wrote:
> Hi,
> I am trying to generate Ada bindings for the GSL (Gnu Scientific
> Library) odeiv2 package (ordinary differential equations). So I do the
> following 2 steps:
> 1. Go to an empty directory "src" and execute
> g++ -c -fdump-ada-spec -C /usr/include/gsl/gsl_odeiv2.h
> 2. Go to an empty directory "obj" and execute
> gcc -c -gnat05 ../src/*.ads
> Unfortunately, gsl_odeiv2.h includes stdio.h, and this leads to a series
> of errors like
>
> stdio_h.ads:117:69: "FILE" not declared in
> "x86_64_linux_gnu_bits_types_FILE_h"
It's best to use the slim variant of that option, then go in and hand
massage the generated code to be "nice" and not the mess you get.
Luke.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-04-15 20:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 17:10 -fdump-ada-spec: "FILE" not declared hreba
2020-04-07 17:19 ` hreba
2020-04-11 17:01 ` hreba
2020-04-15 15:08 ` hreba
2020-04-07 19:29 ` Per Sandberg
2020-04-08 16:13 ` hreba
2020-04-15 20:02 ` Per Sandberg
2020-04-15 15:18 ` Luke A. Guest
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox