comp.lang.ada
 help / color / mirror / Atom feed
* CString
@ 2004-01-18 12:19 Szymon Guz
  2004-01-18 20:37 ` CString Luke A. Guest
  0 siblings, 1 reply; 6+ messages in thread
From: Szymon Guz @ 2004-01-18 12:19 UTC (permalink / raw)


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




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

* Re: CString
  2004-01-18 12:19 CString Szymon Guz
@ 2004-01-18 20:37 ` Luke A. Guest
  2004-01-18 21:27   ` CString Frank J. Lhota
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Luke A. Guest @ 2004-01-18 20:37 UTC (permalink / raw)


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.




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

* Re: CString
  2004-01-18 20:37 ` CString Luke A. Guest
@ 2004-01-18 21:27   ` Frank J. Lhota
  2004-01-18 21:53   ` CString Duncan Sands
  2004-01-18 23:08   ` CString Szymon Guz
  2 siblings, 0 replies; 6+ messages in thread
From: Frank J. Lhota @ 2004-01-18 21:27 UTC (permalink / raw)


"Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> wrote
in message
news:pan.2004.01.18.20.37.15.651012@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk...
> > 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.

That is hardly worthwhile advice for someone who has to work with a third
party library that uses MFC.

Which compiler are you using? IIRC, ObjectAda has an MFC binding. Failing
this, look into porting the MFC definition of CString into Ada.






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

* Re: CString
  2004-01-18 20:37 ` CString Luke A. Guest
  2004-01-18 21:27   ` CString Frank J. Lhota
@ 2004-01-18 21:53   ` Duncan Sands
  2004-01-18 23:08   ` CString Szymon Guz
  2 siblings, 0 replies; 6+ messages in thread
From: Duncan Sands @ 2004-01-18 21:53 UTC (permalink / raw)
  To: Luke A. Guest, comp.lang.ada

On Sunday 18 January 2004 21:37, 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.

Alternatively, use pragma Import_Valued_Procedure (GNAT pragma).

Duncan.



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

* Re: CString
  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   ` Szymon Guz
  2004-01-19  5:27     ` CString David Marceau
  2 siblings, 1 reply; 6+ messages in thread
From: Szymon Guz @ 2004-01-18 23:08 UTC (permalink / raw)


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




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

* Re: CString
  2004-01-18 23:08   ` CString Szymon Guz
@ 2004-01-19  5:27     ` David Marceau
  0 siblings, 0 replies; 6+ messages in thread
From: David Marceau @ 2004-01-19  5:27 UTC (permalink / raw)


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.



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

end of thread, other threads:[~2004-01-19  5:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` CString David Marceau

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