From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6492d1ed552013c9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-18 21:42:07 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!cyclone.bc.net!news-in.mts.net!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Message-ID: <400B6ACC.E14A4644@sympatico.ca> From: David Marceau X-Mailer: Mozilla 4.79 [en] (X11; U; Linux 2.4.17-10mdksmp i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: CString References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 19 Jan 2004 00:27:40 -0500 NNTP-Posting-Host: 65.92.163.147 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1074490457 65.92.163.147 (Mon, 19 Jan 2004 00:34:17 EST) NNTP-Posting-Date: Mon, 19 Jan 2004 00:34:17 EST Organization: Bell Sympatico Xref: archiver1.google.com comp.lang.ada:4544 Date: 2004-01-19T00:27:40-05:00 List-Id: 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.