User Tools

Site Tools


codebase:add_cpp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
codebase:add_cpp [2017/05/24 20:30]
vodur
codebase:add_cpp [2019/07/12 23:16] (current)
vodur
Line 21: Line 21:
 To access C functions from C++, C++ code will need to include the C headers (wrapping in extern "​C"​ { }). To access C functions from C++, C++ code will need to include the C headers (wrapping in extern "​C"​ { }).
  
-To access C++ functions from C, C++ needs to define ​the function inside extern "​C"​ { }.+To access C++ functions from C, C++ needs to declare ​the function inside extern "​C"​ { }.
  
 The extern "​C"​ { } forces C++ to use C naming convention in object file (instead of doing C++ name mangling), which allows the C++ and C objects to link properly. The extern "​C"​ { } forces C++ to use C naming convention in object file (instead of doing C++ name mangling), which allows the C++ and C objects to link properly.
Line 93: Line 93:
 Basically, C++ is not guaranteed to be implemented as a char but it generally is, and almost certainly is and always will be when using GCC. We can even add the static asserts as above just for some peace of mind. Basically, C++ is not guaranteed to be implemented as a char but it generally is, and almost certainly is and always will be when using GCC. We can even add the static asserts as above just for some peace of mind.
  
-https://​bitbucket.org/​aarchon/​mud_src/​commits/​branch/​CPP_COMPAT+[[https://​bitbucket.org/​aarchon/​mud_src/​commits/​branch/​CPP_COMPAT|https://​bitbucket.org/​aarchon/​mud_src/​commits/​branch/​CPP_COMPAT]]
  
  
codebase/add_cpp.txt ยท Last modified: 2019/07/12 23:16 by vodur