Namespaces
Variants
Views
Actions

Talk:cpp/language/language linkage

From cppreference.com

Maybe you should mention the difference between:

extern "C" int x; extern "C" { int x; }

The first one is just a declaration and not a definition. The second one is both definition and declaration. See the standard section 7.5 paragraph 7.

157.181.194.39 11:08, 3 January 2015 (PST)

Actually 7.5 p7 has already been mentioned, at the bottom. I've added a code snippet to demonstrate the said difference. --D41D8CD98F (talk) 07:56, 7 January 2015 (PST)

It would be an idea to add something to the description which points out that this is the keyword to use for building shared libraries or maybe dynamically loadable libraries, too. "g++ -shared" together with 'extern "C"' work well. IMHO better than something like "g++ -rdynamic -fPIC -g -ggdb" and C++-Linkage.

I saw that on stackoverflow.com and hope whoever had that solution found 'extern "C"' and "g++ -shared". --87.189.187.237 12:54, 15 February 2018 (PST)