From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Example Ada calling Gnu Scientific Library (GSL)
Date: Mon, 10 Apr 2017 19:16:37 +0200
Date: 2017-04-10T19:16:37+02:00 [thread overview]
Message-ID: <ocgell$h5r$1@gioia.aioe.org> (raw)
In-Reply-To: el1n97Fiv19U1@mid.individual.net
On 2017-04-10 17:39, hreba wrote:
> On 04/10/2017 11:47 AM, Dmitry A. Kazakov wrote:
>>
>> You also seem confuse project to build and project to use a library.
>> They are not same! For a bindings library you need both.
>>
>
> I don't understand that. From the discussions here on the list I thought:
>
> 1. Thin binding is just an interface module which allows to call the C
> library functions from an Ada program, using all the parameters of the C
> prototype and some types from Interfaces.C.
> Library project.
Yes, plus conversion of some elementary types. It is considered thin to
convert char * to String and int!=0 to Boolean.
> 2. Thick binding: Specification and implementation of Ada subprograms
> which call subprograms of the thin binding. Interfaces.C types can be
> avoided in the specifications. Specification of exported subprograms
> usually differ from corresponding imported C prototypes, because this is
> what you want from thick bindings.
> Library project, because there is no executable.
Yes.
> 3. Application calls subprograms from the thick binding and defines
> executable(s) (Main).
> Non-library project because executables are generated.
AFAIK relocatable library counts as executable, but yes.
> What is wrong here, why do i need both types of projects for a bindings
> library?
It is how gprbuild works. I am not happy with that design but it is how
it is.
You need:
1. C library project [or package Linker / Library_Options]
2.a. Ada thin bindings library build project that with-es #1
2.b. Ada thin bindings library use project that with-es #1
3.a. Ada think bindings library build project that with-es #2.b
3.b. Ada think bindings library use project that with-es #2.b
4. Application build project that with-es #3.b
You can ditch #1 and then:
for #2.a you use package Linker to link to C library
for #2.b you use Linker_Options to instruct future users of the library
that they also must link to the C library
To summarize: for building application or library you use different
options from when you use already built library in another project.
Of course, 2 and 3 are normally merged together. There is little reason
to keep them in separate libraries.
> And is that documented anywhere?
Sure, you can find hints in:
https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/gnat_project_manager.html
P.S. For an example of thin and thick bindings smaller than GtkAda you
can look at ODBC bindings:
http://www.dmitry-kazakov.de/ada/components.htm#ODBC_Bindings
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2017-04-10 17:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 1:29 Example Ada calling Gnu Scientific Library (GSL) Leo Brewin
2017-03-29 7:01 ` gautier_niouzes
2017-03-29 7:23 ` Dmitry A. Kazakov
2017-03-30 12:39 ` gautier_niouzes
2017-03-30 14:22 ` Dmitry A. Kazakov
2017-03-30 20:44 ` Randy Brukardt
2017-03-31 18:31 ` G.B.
2017-03-31 18:50 ` Dmitry A. Kazakov
2017-03-29 7:19 ` hreba
2017-03-29 20:07 ` Randy Brukardt
2017-04-04 21:25 ` hreba
2017-04-05 16:29 ` Simon Wright
2017-04-05 20:21 ` hreba
2017-04-06 7:30 ` Simon Wright
2017-04-07 18:45 ` hreba
2017-04-08 8:28 ` Simon Wright
2017-04-09 10:57 ` hreba
2017-04-09 15:17 ` Simon Wright
2017-04-10 8:53 ` hreba
2017-04-10 9:47 ` Dmitry A. Kazakov
2017-04-10 15:39 ` hreba
2017-04-10 17:16 ` Dmitry A. Kazakov [this message]
2017-04-10 17:43 ` Simon Wright
2017-04-10 15:44 ` Simon Wright
2017-04-11 17:31 ` hreba
2017-04-11 18:45 ` Simon Wright
2017-04-11 19:46 ` 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