comp.lang.ada
 help / color / mirror / Atom feed
From: David Marceau <davidmarceau@sympatico.ca>
Subject: Re: CString
Date: Mon, 19 Jan 2004 00:27:40 -0500
Date: 2004-01-19T00:27:40-05:00	[thread overview]
Message-ID: <400B6ACC.E14A4644@sympatico.ca> (raw)
In-Reply-To: buf3tf$ffr$1@atlantis.news.tpi.pl

Szymon Guz wrote:
> 
> Luke A. Guest wrote:
> > On Sun, 18 Jan 2004 13:19:41 +0100, Szymon Guz wrote:
> >
> >
> >>Hi,
> >>amybe you know in what way should I pass a parameter to a function from
> >>a ddl library that looks like this:
> >>
> >>CString F(CString *, CString);
> >
> >
> > The best thing you can do is to stop using MFC.
> >
> > Luke.
> >
> 
> I know that, but I must use that...
CString::operator() returns a char *.
Please you are going to have to be more specific.
Ada main to C++ DLL?
There are some tricks you can play.
Just because you are using c++ doesn't mean you can't use c declarations and c
functions and export these into a dll.
Read up on this on the www.msdn.com.  There are solutions out there that are
well documented.

The short answer is if it is a plain VC++ DLL, you need to make it talk C
instead.
If it is a COM/DCOM/.NET DLL, you can use gnatcom at www.adapower.com.
The gnatcom/A# stuff is automating some nifty pointer swizzling with vtables at
the lowest level.  
All this also has to conform to some COM/DCOM/.NET specifications so you better
know how to get around in these.

If you were on a linux box with g++, there are solutions for actually using c++
with gnat 
without resorting to some tricking through extern C declarations and extern C
functions.
That said you can't do that with MSVC++.

C++ main to Ada DLL?
Again it's about the same thing, but you have to manage the ada
initialization/finalization when loading up and closing the dll.
Your dll has to conform to the standard microsoft calling convention for dll's.
It was PASCAL and now it's called stdcall or something.

I should remind you that the documentation sets for gnat are very different
depending on what bundles you downloaded.
If you download the windows nt/win32/2000 gnat install bundles, you will get the
correct documentation set with a user's guided adapted to working with windows
stuff i.e. how to import/export dll calls with gnat.
The linux docs mention some stuff about windows but they are not as
thorough....There is a difference.
Just be careful.  

I have a feeling you are looking at the linux bundle gnat docs and not the
windows bundle gnat docs.

I hope this helps.

Cheers.



      reply	other threads:[~2004-01-19  5:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-18 12:19 CString Szymon Guz
2004-01-18 20:37 ` CString Luke A. Guest
2004-01-18 21:27   ` CString Frank J. Lhota
2004-01-18 21:53   ` CString Duncan Sands
2004-01-18 23:08   ` CString Szymon Guz
2004-01-19  5:27     ` David Marceau [this message]
replies disabled

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