From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Export to a Namespace?
Date: Wed, 2 Oct 2002 11:35:01 -0400
Date: 2002-10-02T11:35:01-04:00 [thread overview]
Message-ID: <upm4h64qq5412e@corp.supernews.com> (raw)
In-Reply-To: 3D948F1F.9A87CE48@boeing.com
"Jeremy T. Smith" <jeremy.t.smith2@boeing.com> wrote in message
news:3D948F1F.9A87CE48@boeing.com...
>
> 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;
> }
The problem is you don't know how the compiler mangles names.
What I would do is use extern but with C linkage, e.g.
extern "C" {
extern int My_Wrapper_First_Val;
extern int My_Wrapper_Next_Val;
}
or something like that.
I'm not sure external linkage and C++ namespaces are really compatible.
If you really want to keep the namespace, you could try something like:
namespace My_Wrapper {
int First_Val();
int Next_Val();
}
inline int My_Wrapper::First_Val()
{
return My_Wrapper_First_Val;
}
inline int My_Wrapper::Next_Val()
{
return My_Wrapper_Next_Val;
}
or something like that.
prev parent reply other threads:[~2002-10-02 15:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-27 17:02 Export to a Namespace? Jeremy T. Smith
2002-09-27 18:15 ` Pascal Obry
2002-09-27 18:52 ` Stephen Leake
2002-10-02 15:35 ` Matthew Heaney [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