ggambetta / libz80

An emulator of the Z80 processor (C library)
145 stars 32 forks source link

Fix C++ linkage #3

Closed Ybalrid closed 5 years ago

Ybalrid commented 6 years ago

C code works "out of the box" in C++, but to link a valid executable, C functions needs to be declared as extern "C".

This patch adds a preprocessor define (only active when header is #included by a C++ compiler) enclosing the definitions in an extern "C" block, fixing linkage errors on all platforms.

Also adds relevant comments explaining the presence of the extern "C" block.