comp.lang.ada
 help / color / mirror / Atom feed
* DLLs with GNAT
@ 2005-10-14 21:49 Adaddict
  2005-10-14 23:50 ` Jeff Creem
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Adaddict @ 2005-10-14 21:49 UTC (permalink / raw)


Is there any way to generate DLLs with GNAT that you could call from a
Visual Studio code?

Is there any way to do that at all with Ada?

Thanks in advance for your answers.

Regards




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

* Re: DLLs with GNAT
  2005-10-14 21:49 DLLs with GNAT Adaddict
@ 2005-10-14 23:50 ` Jeff Creem
  2005-10-15  9:50   ` Makhno
  2005-10-15  7:06 ` Martin Krischik
  2005-10-16 16:13 ` Adaddict
  2 siblings, 1 reply; 6+ messages in thread
From: Jeff Creem @ 2005-10-14 23:50 UTC (permalink / raw)


Adaddict wrote:
> Is there any way to generate DLLs with GNAT that you could call from a
> Visual Studio code?

yes

> 
> Is there any way to do that at all with Ada?
> 
yes

> Thanks in advance for your answers.
> 
> Regards
> 

If you read the GNAT users guide there is a section called:

Microsoft Windows Topics

It covers how to create DLLs under Windows.

I've used DLLs i created in C++ and VBA (under excel).
I have not tried anything with Visual Studio.NET




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

* Re: DLLs with GNAT
  2005-10-14 21:49 DLLs with GNAT Adaddict
  2005-10-14 23:50 ` Jeff Creem
@ 2005-10-15  7:06 ` Martin Krischik
  2005-10-16 16:13 ` Adaddict
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Krischik @ 2005-10-15  7:06 UTC (permalink / raw)


Adaddict wrote:

> Is there any way to generate DLLs with GNAT that you could call from a
> Visual Studio code?

Yes.
 
> Is there any way to do that at all with Ada?

Yes.
 
> Thanks in advance for your answers.

I suggest you get yourself a current version of the GPS. The current
versions have "shared library" support. 

For visual studio support there is a bit more to be done - you need the
right export options. I once did all that but I never packaged it up but
the sources are available by cvs:

:pserver:anonymous@cvs.sourceforge.net:/cvsroot/adacl

Regards

Martin

Links:

  http://en.wikipedia.org/wiki/GNAT_Programming_Studio
  http://cvs.sourceforge.net/viewcvs.py/adacl/CUnicode/Scripts

-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



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

* Re: DLLs with GNAT
  2005-10-14 23:50 ` Jeff Creem
@ 2005-10-15  9:50   ` Makhno
  0 siblings, 0 replies; 6+ messages in thread
From: Makhno @ 2005-10-15  9:50 UTC (permalink / raw)


> I've used DLLs i created in C++ and VBA (under excel).
> I have not tried anything with Visual Studio.NET

It works fine. One thing they don't tell you is that you can get GNAT to
print out the alignment of some ADA records as its compiling, though for
some reason it seems to occasionally miss records.
To link to functions that take records as arguments, you can pass a pointer
to an equivalently-aligned C-style struct and call it with the default
C-style calling convention. If ada returns a record as the result of a
function, you must link to it using the __stdcall convention, and the struct 
is returned 'as value' to C (rather than as a pointer).

Arrays that are dimensioned [1...n] have size n (indexed 0...n-1 in C),
whereas arrays that are dimensioned [0...n] have size n+1. Easy to miss this
one (could've left work at 7 on Wednesday, but because of this I left at 8).









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

* Re: DLLs with GNAT
  2005-10-14 21:49 DLLs with GNAT Adaddict
  2005-10-14 23:50 ` Jeff Creem
  2005-10-15  7:06 ` Martin Krischik
@ 2005-10-16 16:13 ` Adaddict
  2005-10-16 20:09   ` Pascal Obry
  2 siblings, 1 reply; 6+ messages in thread
From: Adaddict @ 2005-10-16 16:13 UTC (permalink / raw)


Ok... thanks for your replies. So, if it is possible, is there any tutorial
of how to do it? The only one that I found and followed is this one:

http://www.tertullian.org/rpearse/ada_dll/ada_dll.htm

which succefully creates a dll, yes, but I can't call it from Visual
Studio as I've done with others. That tutorial also says what I first
asked, that GNAT generated dlls are not callable from VS.

Forgive me for asking too much, but my knowledge level about programation
stills very low.

As note, I currently use either Ada GIDE for simple programs and GPS
Academic Edition for lager projects. Both compiling with GNAT GAP 2005a.

Thanks again.




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

* Re: DLLs with GNAT
  2005-10-16 16:13 ` Adaddict
@ 2005-10-16 20:09   ` Pascal Obry
  0 siblings, 0 replies; 6+ messages in thread
From: Pascal Obry @ 2005-10-16 20:09 UTC (permalink / raw)
  To: Adaddict

Adaddict a �crit :
> Ok... thanks for your replies. So, if it is possible, is there any tutorial
> of how to do it? The only one that I found and followed is this one:
> 
> http://www.tertullian.org/rpearse/ada_dll/ada_dll.htm

This is old stuff!

The documentation is in the very secret document called the GNAT User's
Guide.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

end of thread, other threads:[~2005-10-16 20:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-14 21:49 DLLs with GNAT Adaddict
2005-10-14 23:50 ` Jeff Creem
2005-10-15  9:50   ` Makhno
2005-10-15  7:06 ` Martin Krischik
2005-10-16 16:13 ` Adaddict
2005-10-16 20:09   ` Pascal Obry

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