gnat

Ada: gnat gprbuild How to link in libraries?

两盒软妹~` 提交于 2019-12-10 11:05:50
问题 In this multi-language GPRBuild project I'm working on, I have some c++ library files (*.a) I need to link into my executable. Is there an gpr attribute to tell it what to link in or anyway to pass -l -L switches to the linker? 回答1: Or even better: Project my_library is For externally_built use "true"; For library_dir use "/where/ever"; For library_name use "mylibname"; For source_dirs use (); -- no sources. For library_kind use "static"; -- if it is a static lib .a -- for library_kind use

Get Ada (compiled with GNAT) to import files from outside current directory?

你。 提交于 2019-12-10 02:52:16
问题 I'm doing an intro to programming course at university, and the language of choice is Ada. I'm coding in Kate and compiling with GNAT 4.6.3. We have to use teacher-provided libraries for our programs, like so: with foo; use foo; Of course, then the file foo.adb has to be contained in the same directory as my source file. Since multiple projects depend on this one library, and I like to keep each project in its own subdirectory, I have to copy the library files into each new project. Not to

How to create an ada lib.a and link to C

主宰稳场 提交于 2019-12-09 12:33:28
问题 I am trying to create an ada library and have tried a few different things. I have tried compiling the project using makefiles and trying to create a library from all the .o files This seemed to not work as expected. I then asked adacore support and they pointed me in the direction of using .gpr files for both the ada and c projects and withing in the ada.gpr that should create a library. This almost worked but when it tries to compile the ada I get undefined references. What I have tried:

How to write gnatcheck rules

本小妞迷上赌 提交于 2019-12-06 09:35:04
Is it possible to write your own gnatcheck rules, and if so, can someone point me to a good reference? I am searching for a particular "style" that is being used, and would love if I could simply write a rule that says if you see said style, it will throw up a warning, or an error, this way we can flag when this isn't following a particular standard. A bit of background may be helpful here. While the style checks hold out a lot of promise for enforcing user style guidelines, that isn't exactly what they are for. The main purpose of those checks is to enforce Ada Core 's (The folks who maintain

Dynamically link libgnat

冷暖自知 提交于 2019-12-06 06:15:24
I'm trying to compile a very simple ADA code. Everything works like a charm but on one computer my executable is link dynamically to libgnat whereas on the other computer it's linked statically. In both cases I use gnatmake tool. Any idea why it's happening? Do you know a way to force GNAT to dynamically link libraries? That would be the binder's -shared switch. If you are using project files, you can use: project Foo is ... package Binder is for Switches ("Ada") use ("-shared"); end Binder; end Foo; 来源: https://stackoverflow.com/questions/26167386/dynamically-link-libgnat

Ada: gnat gprbuild How to link in libraries?

假如想象 提交于 2019-12-06 05:23:17
In this multi-language GPRBuild project I'm working on, I have some c++ library files (*.a) I need to link into my executable. Is there an gpr attribute to tell it what to link in or anyway to pass -l -L switches to the linker? persan Or even better: Project my_library is For externally_built use "true"; For library_dir use "/where/ever"; For library_name use "mylibname"; For source_dirs use (); -- no sources. For library_kind use "static"; -- if it is a static lib .a -- for library_kind use "dynamic"; -- if it is an so. End my_library; And in the application project. With "my_library.gpr";

How do I compile and link using gnatmake with an Ada shared library?

狂风中的少年 提交于 2019-12-05 15:18:49
I am having trouble compile an applicant again the Florist library. Turns out I have a larger issue with florist (same error results from both newest 2010 Adacore GPL download and 2009 version in Debian's archive). Florist has some low-level issues but when I look through the generated files it seems to be including errno.h correctly. Here is what happens when I build florist: gcc-4.4 -c -I/usr/share/ada/adainclude/florist demo.adb gcc-4.4 -c -I./ -I/usr/share/ada/adainclude/florist -I- /usr/share/ada/adainclude/florist/posix.adb gcc-4.4 -c -I./ -I/usr/share/ada/adainclude/florist -I- /usr

Get Ada (compiled with GNAT) to import files from outside current directory?

六月ゝ 毕业季﹏ 提交于 2019-12-05 02:35:11
I'm doing an intro to programming course at university, and the language of choice is Ada. I'm coding in Kate and compiling with GNAT 4.6.3. We have to use teacher-provided libraries for our programs, like so: with foo; use foo; Of course, then the file foo.adb has to be contained in the same directory as my source file. Since multiple projects depend on this one library, and I like to keep each project in its own subdirectory, I have to copy the library files into each new project. Not to mention have my library code and source code all in the same directory. So is there any way to sort of go

Calling scanf from Ada

独自空忆成欢 提交于 2019-12-02 06:30:57
问题 How do you call scanf from Ada? That is, presumably with an appropriate pragma import declaration, but what would the declaration look like? (I'm interested in how to call C functions of the more unruly variety from Ada, not how to parse strings per se, so I'm not looking for a pure Ada solution. My setup is Gnat, Ubuntu Linux, x64 if it makes a difference.) 回答1: This paper points out that Ada has no way of declaring a function that takes different numbers of parameters of different types.

Ada compiler crashes with “Ada compiler not installed on this system.” after downgrading gcc version

戏子无情 提交于 2019-12-02 04:01:55
问题 I downgraded my gcc version 4.6.3 to 4.3.4 but ada version is not changed gnat-4.6.3 so I got error Ada compiler not installed on this system. How to set my ada to gnat 4.3.4? 回答1: It depends on what system you're running on and how you installed it. You need to either install GNAT from the same build of GCC, or you need to install GNAT in such a way that it doesn't interfere with the rest of GCC. 来源: https://stackoverflow.com/questions/11538813/ada-compiler-crashes-with-ada-compiler-not