comp.lang.ada
 help / color / mirror / Atom feed
From: Dave Thompson <david.thompson1@worldnet.att.net>
Subject: Re: pragma import ambiguity
Date: Thu, 21 Sep 2006 01:26:52 GMT
Date: 2006-09-21T01:26:52+00:00	[thread overview]
Message-ID: <6l8sg2d6hs5cfnfp2ag889n8qrhea3afkf@4ax.com> (raw)
In-Reply-To: 1157560770.358187.249610@i3g2000cwc.googlegroups.com

On 6 Sep 2006 09:39:30 -0700, "bubble" <kuan_long@hotmail.com> wrote:
(topposted, not worth the trouble of correcting)

> are you mean there are the same name symbols in a library?
> 
> I assume your library is standard winapi and writing in C not C++.
> the C++ have name decoration problem
> to avoid the name decoration problem
> 
This wasn't the OP's problem (which was within the Ada) and he(WLOG)
didn't say anything to indicate he is using C++. But even if so:

> you "may" use external "C" to solve it.
> 
> like
> 
> #ifdef __cplusplus
>   external "{"

extern "C" {

> #end if

#endif 

>                 __declspec(dllexport) int clear;
>                 int __declspec(dllexport)  __stdcall clear();
> 
Non-standard Windows-only; but the OP _did_ imply Windows.

> 
> #ifdef __cplusplus
> }
> end if
> 
#endif

> I think your C/C++ compiler should allow to compiler it because  C does
> not allow the same name in code.
> 
Neither does C++ when using extern "C", formally called C linkage. And
even in "real C++", you can't have both a function/routine and
variable with the same name in the same namespace; overloading only
works among function/routines, not for variables or typenames.

- David.Thompson1 at worldnet.att.net



  parent reply	other threads:[~2006-09-21  1:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06 16:05 pragma import ambiguity tmoran
2006-09-06 16:39 ` bubble
2006-09-06 16:42   ` bubble
2006-09-06 17:47   ` Pascal Obry
2006-09-21  1:26   ` Dave Thompson [this message]
2006-09-06 17:34 ` Frank J. Lhota
2006-09-06 18:06   ` Gautier
2006-09-07  7:53   ` Dmitry A. Kazakov
2006-09-07 19:35   ` Adam Beneschan
2006-09-08  3:48     ` Randy Brukardt
replies disabled

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