comp.lang.ada
 help / color / mirror / Atom feed
* Can someone who doesn't know C ever hope to write thick bindings for a C library to Ada?
@ 2013-09-29 20:28 Kevin Keith
  2013-09-30  0:36 ` Shark8
  2013-09-30 14:01 ` Marius Amado-Alves
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Keith @ 2013-09-29 20:28 UTC (permalink / raw)


Okay, so I *sort of* know C, but I'm by no means an expert or proficient in it. I sort of know it in that I can kinda sort follow well commented C code. Earlier I posted about thick SDL bindings, and another person asked if it were possible to utilize C2Ada without knowing C, my question is sort of in between. Is it possible to write thick bindings from auto-generated C bindings (using GNAT) without really knowing C very well?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can someone who doesn't know C ever hope to write thick bindings for a C library to Ada?
  2013-09-29 20:28 Can someone who doesn't know C ever hope to write thick bindings for a C library to Ada? Kevin Keith
@ 2013-09-30  0:36 ` Shark8
  2013-09-30 14:01 ` Marius Amado-Alves
  1 sibling, 0 replies; 3+ messages in thread
From: Shark8 @ 2013-09-30  0:36 UTC (permalink / raw)


On Sunday, September 29, 2013 2:28:45 PM UTC-6, Kevin Keith wrote:
> Okay, so I *sort of* know C, but I'm by no means an expert or proficient in it. I sort of know it in that I can kinda sort follow well commented C code. Earlier I posted about thick SDL bindings, and another person asked if it were possible to utilize C2Ada without knowing C, my question is sort of in between. Is it possible to write thick bindings from auto-generated C bindings (using GNAT) without really knowing C very well?

Yes. I'm certainly no C expert and I'm doing it.
See https://github.com/OneWingedShark/TAO-GL

Several things to watch out for:
1) Using pointers/addresses for arrays, get those to proper Ada arrays ASAP.
2) Keep an eye out for subtyping possibilities. [esp null exclusion or non-numeric exclusions for IEEE754 floats.]
3) It can get kind of tedious, if you don't autogenerate stuff and/or have a clear idea in mind for the interface.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can someone who doesn't know C ever hope to write thick bindings for a C library to Ada?
  2013-09-29 20:28 Can someone who doesn't know C ever hope to write thick bindings for a C library to Ada? Kevin Keith
  2013-09-30  0:36 ` Shark8
@ 2013-09-30 14:01 ` Marius Amado-Alves
  1 sibling, 0 replies; 3+ messages in thread
From: Marius Amado-Alves @ 2013-09-30 14:01 UTC (permalink / raw)


You have to understand C types including function prototypes and their mapping to Ada types. Make a thin binding first using Interfaces, System, etc. Then a thick binding that uses only that. Example:
http://sourceforge.net/p/aquaterm/git/ci/master/tree/adapters/ada/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-30 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-29 20:28 Can someone who doesn't know C ever hope to write thick bindings for a C library to Ada? Kevin Keith
2013-09-30  0:36 ` Shark8
2013-09-30 14:01 ` Marius Amado-Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox