comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeremy T. Smith" <jeremy.t.smith2@boeing.com>
Subject: Export to a Namespace?
Date: Fri, 27 Sep 2002 17:02:23 GMT
Date: 2002-09-27T17:02:23+00:00	[thread overview]
Message-ID: <3D948F1F.9A87CE48@boeing.com> (raw)

I'm supporting a large mass of legacy Ada and my boss wants to add new
functions using C++.  There are about 2000 constants defined in the Ada
code that we'll need visible to C++.  Not a problem, a quick Perl script
will add a pragma Export after each declaration.  The values being
exported are resolved at compile time, otherwise I'd just duplicat the
declarations in C++.

BUT, our system architect is a stickler about not polluting the global
namespace, so can I export from Ada to a C++ namespace?  Perhaps
something like (though this won't compile on my Green Hills compiler):

C++ Side:
namespace My_Wrapper {
   extern int First_Val;
   extern int Next_Val;
}

Ada Side:
   First_Val : constant integer := Some_Withed_In_Named_Number;
pragma Export(CPP, First_Val, "My_Wrapper::First_Val");
   Next_Val : constant integer := First_Val'Succ;
pragma Export(CPP, Next_Val, "My_Wrapper::Next_Val");

Any help would be much appreciated, even if it's just a "You can't do
that"!

Thanks

Jeremy



             reply	other threads:[~2002-09-27 17:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-27 17:02 Jeremy T. Smith [this message]
2002-09-27 18:15 ` Export to a Namespace? Pascal Obry
2002-09-27 18:52 ` Stephen Leake
2002-10-02 15:35 ` Matthew Heaney
replies disabled

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