Mangling namespace std

General FreeBASIC programming questions.
Post Reply
Rule
Posts: 16
Joined: Nov 03, 2020 19:04
Contact:

Mangling namespace std

Post by Rule »

FreeBASIC seems to treat namespace std as any other namespace, mangling std::foobar to N3std6foobarE instead of St6foobar as gcc does. Is this by design? Placing the declaration inside an extern "C++" block doesn't effect the mangled name.
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Mangling namespace std

Post by fxm »

See this post : Re: Wiki improvements (third example)
Rule
Posts: 16
Joined: Nov 03, 2020 19:04
Contact:

Re: Mangling namespace std

Post by Rule »

fxm Sorry, that doesn't seem to answer the question. FreeBASIC follows (more or less) gcc's name mangling rules, except for namespace std, which impedes linking with the C++ library. This may be by design if there are compatibility issues between FreeBASIC and gcc, but otherwise I would think it's a bug.

P.S. I'm not trying to link with the C++ library but I am working on a demangler that translates mangled names to FreeBASIC syntax, unlike __cxa_demangle that translates to C++ syntax.
coderJeff
Site Admin
Posts: 4332
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Mangling namespace std

Post by coderJeff »

freebasic does not reserve "std" for any special use, and there's no support for the std namespace mangling rules

But if std c++ name mangling were added, I would probably do like this for syntax:

Code: Select all

extern "c++"
	namespace std alias "::std::"
		'' declarations
	end namespace
end extern
Still nothing special about 'std', but tells fbc to mangle 'std' as 'St' ... plus other rules (probably)
Post Reply