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-Thread: 103376,8a3b943d6cda9a77 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rob W. Norris Newsgroups: comp.lang.ada Subject: Re: Importing and using a C++ class in Ada. Pragma Cpp_Constructor,Cpp_Class Date: Fri, 06 May 2005 10:03:36 +0100 Message-ID: <1bcm71h665mr88ohoi4s7c1824jenq2ta0@4ax.com> References: <20050505100047.AB84F4C40D0@lovelace.ada-france.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net gJRBlz1Bzeb4iF+jV6yT5AFTpzy1Jhnh9253EmHpuUyY4HxFHA X-Orig-Path: glkas0286.greenlnk.net!glkas0286!not-for-mail X-Newsreader: Forte Free Agent 1.92/32.572 X-Original-NNTP-Posting-Host: glkas0286.greenlnk.net Xref: g2news1.google.com comp.lang.ada:10941 Date: 2005-05-06T10:03:36+01:00 List-Id: "Christopher Gosset" scribbled: >I need to use some classes from a DLL in my Ada app. I was hoping that >this was a straigthforward thing to do using pragma import and pragma >cpp_class and cpp_constructor. Is there a working example of this >somwhere. I am building the damn dll myself and I am also buliding the >damn .def file myself but the damn thing will still not work. Functions >that are not class members are no problem this works perfect! Are there >any tutorials, sample code available on this? As I see it this is far >from intuitive and its a major reason for NOT converting to ada. What I >would like is a simple "MS Visual Studio " like library brows tree >thing. So instead of having to "build a new operating system" to solve >even the most trivial task, such as calling a member function or a >constructor I could actually add a with clause or import clause and then >be able to see whats available in the lib. > >So if anyone has a working sample on the usage of these pragmas I would >be more than happy. > >I assume that the fact that there are no examples of the usage of these >Pragmas in the userguide or reference manual suggests that this is not >as straigth forward as advertised. >/CG There's an example off the pragmas working in The Big Online Book of Linux Ada. http://www.pegasoft.ca/resources/boblap/19.html#19.5 Obivously, it's geared to Linux. The hard part is when classes get big with virtual functions all over the place as you have to resolve the actual function mapping and symbol table offsets yourself. The simplest way is often to write a pure C style wrapper around the C++ calls so the Ada can map to that. -- Rob W. Norris Top Posters Rule? Begin the revolution.