This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Prevent macro expansion of mblen
Alexandre Oliva <aoliva@redhat.com> writes:
| On Dec 30, 2000, Gabriel Dos Reis <gdr@codesourcery.com> wrote:
|
| > // file a.c coming from a "C"-program
| > #include <stddef.h>
| > void f() { extern int mblen(const char*, size_t); // ... }
|
| This, by itself, will miscompile if mblen is #defined.
I took care to just #include <stddef.h> which is not supposed to
defined mblen. Anyway, the point is there.
|
| > // file b.C part of a "C++"-program
| > #include <cstdlib>
| > extern "C" void f();
| > void g() { f(); }
|
| > We need a way to make the call to f() work. Do you see what I'm
| > trying to say?
|
| Nope. I really don't see why f() wouldn't work. It seems to me it
| would work just fine.
You get a link-time error if mblen() has a C++ linkage -- that is one
of the reasons why we want all C-funtions to have C linkage.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com