About 57 results
Open links in new tab
  1. How to correctly use the extern keyword in C - Stack Overflow

    Jan 31, 2009 · My question is about when a function should be referenced with the extern keyword in C. I am failing to see when this should be used in practice. As I am writing a program all of the functions …

  2. How do I use extern to share variables between source files?

    1281 I know that global variables in C sometimes have the extern keyword. What is an extern variable? What is the declaration like? What is its scope? This is related to sharing variables across source …

  3. What is the effect of extern "C" in C++? - Stack Overflow

    Jun 25, 2009 · extern "C" makes a function-name in C++ have C linkage (compiler does not mangle the name) so that client C code can link to (use) your function using a C compatible header file that …

  4. When to use extern in C++ - Stack Overflow

    I'm reading "Think in C++" and it just introduced the extern declaration. For example: extern int x; extern float y; I think I understand the meaning (declaration without definition), but I wonde...

  5. In simple words, when should I use extern "C"? [duplicate]

    44 You need to use extern "C" in C++ when declaring a function that was implemented/compiled in C. The use of extern "C" tells the compiler/linker to use the C naming and calling conventions, instead …

  6. Why would you use 'extern "C++"'? - Stack Overflow

    Mar 4, 2009 · The use case for extern "C++" is when calling C++ library function in a C function. The sub-use case, that is relevant, is when linking a C++ library with a C source code with main function.

  7. c++ - How does extern work? - Stack Overflow

    Aug 26, 2013 · 2 You use extern to tell the compiler that the variable is defined elsewhere. Without extern in your program compiler would define another variable a (in addition to this in the global …

  8. c - What's the difference between using extern and #including header ...

    Aug 23, 2011 · The other is using header files: Declare functions/variables using extern in a header file (*.h/*.hh). Still, extern is optional for functions, but not for variables. So you don't normally see extern …

  9. When should I use extern "C" in C++? - Stack Overflow

    extern "C" { #include "c_only_header.h" } Otherwise, you might get linker errors, because the library contains the functions with C-linkage (_myfunc), but the C++ compiler, which processed the library's …

  10. c - What does the extern keyword mean? - Stack Overflow

    41 The extern keyword declares a variable or function and specifies that it has external linkage (its name is visible from files other than the one in which it's defined). When modifying a variable, extern …