comp.lang.ada
 help / color / mirror / Atom feed
From: "Makhno" <root@127.0.0.1>
Subject: Re: DLLs with GNAT
Date: Sat, 15 Oct 2005 10:50:06 +0100
Date: 2005-10-15T09:51:48+00:00	[thread overview]
Message-ID: <diqjfk$1hl$1@news8.svr.pol.co.uk> (raw)
In-Reply-To: BYmdnXSP1p-82c3enZ2dnUVZ_s-dnZ2d@comcast.com

> 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).









  reply	other threads:[~2005-10-15  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-14 21:49 DLLs with GNAT Adaddict
2005-10-14 23:50 ` Jeff Creem
2005-10-15  9:50   ` Makhno [this message]
2005-10-15  7:06 ` Martin Krischik
2005-10-16 16:13 ` Adaddict
2005-10-16 20:09   ` Pascal Obry
replies disabled

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