comp.lang.ada
 help / color / mirror / Atom feed
* [GNAT]  Importing a C/C++ library from within Ada?
@ 2005-04-20 19:52 conradwt
  2005-04-20 20:11 ` Frank J. Lhota
  2005-04-23 16:04 ` Rod Kay
  0 siblings, 2 replies; 8+ messages in thread
From: conradwt @ 2005-04-20 19:52 UTC (permalink / raw)


Hi, I was wondering, is there an efficient way to import a C/C++
library withing Ada on Linux platform using GNAT.  I simply like to be
able to access the functions/methods from Ada.

Thanks in advance,

-Conrad




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

* Re: [GNAT]  Importing a C/C++ library from within Ada?
  2005-04-20 19:52 [GNAT] Importing a C/C++ library from within Ada? conradwt
@ 2005-04-20 20:11 ` Frank J. Lhota
  2005-04-23 16:04 ` Rod Kay
  1 sibling, 0 replies; 8+ messages in thread
From: Frank J. Lhota @ 2005-04-20 20:11 UTC (permalink / raw)


The GNAT manual should describe the CPP interface package and associated 
pragmas to support imported C++ code. My advice is to RTFM (Read The 
Fantastic Manual).

<conradwt@runbox.com> wrote in message 
news:1114026742.256627.5450@g14g2000cwa.googlegroups.com...
> Hi, I was wondering, is there an efficient way to import a C/C++
> library withing Ada on Linux platform using GNAT.  I simply like to be
> able to access the functions/methods from Ada.
>
> Thanks in advance,
>
> -Conrad
> 





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

* Re: [GNAT]  Importing a C/C++ library from within Ada?
  2005-04-20 19:52 [GNAT] Importing a C/C++ library from within Ada? conradwt
  2005-04-20 20:11 ` Frank J. Lhota
@ 2005-04-23 16:04 ` Rod Kay
  2005-04-23 20:35   ` Jeff C
  2005-04-25  7:50   ` Alex R. Mosteo
  1 sibling, 2 replies; 8+ messages in thread
From: Rod Kay @ 2005-04-23 16:04 UTC (permalink / raw)
  To: comp.lang.ada

Today 01:11:23 am

On Thu, 21 Apr 2005 05:52 am, conradwt@runbox.com wrote:
> Hi, I was wondering, is there an efficient way to import a C/C++
> library withing Ada on Linux platform using GNAT.  I simply like to be
> able to access the functions/methods from Ada.
>

    I'm in the middle of building an Ada module for SWIG, which will generate 
Ada bindings to C/C++ librarys.

    The module is still in the early stages, but can produce bindings 
(currently rather ugly ones) for very simple C and C++ libraries. 

    After I work through a majority of the SWIG test suite, and clean up the 
code, the module should go into the SWIG cvs, and be available for general 
use.

    The initial release will provide support for all of C and simple 
inheritance in C++. Exceptions and multiple inheritance, will be catered for 
in later versions.



regards,

Rod.



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

* Re: [GNAT]  Importing a C/C++ library from within Ada?
  2005-04-23 16:04 ` Rod Kay
@ 2005-04-23 20:35   ` Jeff C
  2005-04-25  7:50   ` Alex R. Mosteo
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff C @ 2005-04-23 20:35 UTC (permalink / raw)


Rod Kay wrote:
> Today 01:11:23 am
> 
> On Thu, 21 Apr 2005 05:52 am, conradwt@runbox.com wrote:
> 
>>Hi, I was wondering, is there an efficient way to import a C/C++
>>library withing Ada on Linux platform using GNAT.  I simply like to be
>>able to access the functions/methods from Ada.
>>
> 
> 
>     I'm in the middle of building an Ada module for SWIG, which will generate 
> Ada bindings to C/C++ librarys.
> 

That is encouraging.. While I have not used SWIG 
(http://www.swig.org/exec.html) at all it looks like a nice idea. I've 
been spoiled a bit by gnatcom's ability to auto generate COM bindings so 
I am always a little put off when I have to hand bind to something under 
Linux.



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

* Re: [GNAT]  Importing a C/C++ library from within Ada?
  2005-04-23 16:04 ` Rod Kay
  2005-04-23 20:35   ` Jeff C
@ 2005-04-25  7:50   ` Alex R. Mosteo
  2005-04-26  1:07     ` Rod Kay
  1 sibling, 1 reply; 8+ messages in thread
From: Alex R. Mosteo @ 2005-04-25  7:50 UTC (permalink / raw)


Rod Kay wrote:
> Today 01:11:23 am
> 
> On Thu, 21 Apr 2005 05:52 am, conradwt@runbox.com wrote:
> 
>>Hi, I was wondering, is there an efficient way to import a C/C++
>>library withing Ada on Linux platform using GNAT.  I simply like to be
>>able to access the functions/methods from Ada.
>>
> 
>     I'm in the middle of building an Ada module for SWIG, which will generate 
> Ada bindings to C/C++ librarys.

Excellent!

>     The module is still in the early stages, but can produce bindings 
> (currently rather ugly ones) for very simple C and C++ libraries. 
> 
>     After I work through a majority of the SWIG test suite, and clean up the 
> code, the module should go into the SWIG cvs, and be available for general 
> use.

Please give a heads-up when that happens. I'm very interested on it.

>     The initial release will provide support for all of C and simple 
> inheritance in C++. Exceptions and multiple inheritance, will be catered for 
> in later versions.

Will this module generate bindings for any compiler or gnat specific?



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

* Re: [GNAT]  Importing a C/C++ library from within Ada?
  2005-04-25  7:50   ` Alex R. Mosteo
@ 2005-04-26  1:07     ` Rod Kay
  2005-04-26  9:52       ` Alex R. Mosteo
  0 siblings, 1 reply; 8+ messages in thread
From: Rod Kay @ 2005-04-26  1:07 UTC (permalink / raw)
  To: comp.lang.ada

On Mon, 25 Apr 2005 05:50 pm, Alex R. Mosteo wrote:
> >     The initial release will provide support for all of C and simple
> > inheritance in C++. Exceptions and multiple inheritance, will be catered
> > for in later versions.
>
> Will this module generate bindings for any compiler or gnat specific?

    I'm using Gnat to test the module, but the bindings should work with any 
Ada compiler. At least that is the goal.





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

* Re: [GNAT]  Importing a C/C++ library from within Ada?
  2005-04-26  1:07     ` Rod Kay
@ 2005-04-26  9:52       ` Alex R. Mosteo
  2005-04-26 11:48         ` Rod Kay
  0 siblings, 1 reply; 8+ messages in thread
From: Alex R. Mosteo @ 2005-04-26  9:52 UTC (permalink / raw)


Rod Kay wrote:
> On Mon, 25 Apr 2005 05:50 pm, Alex R. Mosteo wrote:
> 
>>>    The initial release will provide support for all of C and simple
>>>inheritance in C++. Exceptions and multiple inheritance, will be catered
>>>for in later versions.
>>
>>Will this module generate bindings for any compiler or gnat specific?
> 
> 
>     I'm using Gnat to test the module, but the bindings should work with any 
> Ada compiler. At least that is the goal.

I thought that Ada95 doesn't provide standard means to interface to C++. 
Has this changed for Ada0Y? Am I wrong in my belief?

Best regards,

	Alex.



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

* Re: [GNAT]  Importing a C/C++ library from within Ada?
  2005-04-26  9:52       ` Alex R. Mosteo
@ 2005-04-26 11:48         ` Rod Kay
  0 siblings, 0 replies; 8+ messages in thread
From: Rod Kay @ 2005-04-26 11:48 UTC (permalink / raw)
  To: comp.lang.ada

On Tue, 26 Apr 2005 07:52 pm, Alex R. Mosteo wrote:
> Rod Kay wrote:
> > On Mon, 25 Apr 2005 05:50 pm, Alex R. Mosteo wrote:
> >>>    The initial release will provide support for all of C and simple
> >>>inheritance in C++. Exceptions and multiple inheritance, will be catered
> >>>for in later versions.
> >>
> >>Will this module generate bindings for any compiler or gnat specific?
> >
> >     I'm using Gnat to test the module, but the bindings should work with
> > any Ada compiler. At least that is the goal.
>
> I thought that Ada95 doesn't provide standard means to interface to C++.
> Has this changed for Ada0Y? Am I wrong in my belief?
>

    I'm not sure that the Ada95 standard directly supports interfacing to C++, 
but, at the moment,  the SWIG Ada module simply 'wraps' C++ classes.

    Later versions will hopefully improve the generated bindings to conform 
more to the Ada style.

    The SWIG ada module will only support simple C++ inheritance in it first 
release. I'm hoping Ada0Y (Y => 5 ?) will aid full support of C++ multiple 
inheritance, possibly via Ada0Y's proposed multiple interface inheritance 
(although I've not looked into this too closely, as yet).

    Sorry if this is a little vague, but it's early days yet. GCC-4.0.0 has 
just come out (a godsend), with considerable support for the proposed Ada0Y 
enhancements. I'll use GCC-4.0.0 and (proposed) Ada0Y (5?) as the initial 
target for the bindings, although support for any Ada compiler/platform is 
planned.

    Here is a rough schedule, in response to an offlist query ...
    
             ------------------------------------------------------
> I just would like to ask you when do you plan to finish that job?
> Approximately?
>

    I hope to add a simple version of the module to the SWIG cvs sometime next 
week. This should produce bindings for most C and 'simple' C++ librarys.

    I plan to work on the module steadily over the next month, to tidy up the 
code and improve the bindings. There is also a deal of work to be done for 
C++ bindings.

    I suppose a barely usable version might be ready in a weeks time, a usable 
version within 2-4 weeks, and a decent (full C/C++) version in 3 months.

            --------------------------------------------------------



regards,

Rod.



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

end of thread, other threads:[~2005-04-26 11:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-20 19:52 [GNAT] Importing a C/C++ library from within Ada? conradwt
2005-04-20 20:11 ` Frank J. Lhota
2005-04-23 16:04 ` Rod Kay
2005-04-23 20:35   ` Jeff C
2005-04-25  7:50   ` Alex R. Mosteo
2005-04-26  1:07     ` Rod Kay
2005-04-26  9:52       ` Alex R. Mosteo
2005-04-26 11:48         ` Rod Kay

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