Q. When linking C or Assembly language modules with C++ modules I get
undefined symbol errors at link time. It appears that none of the C
or Assembly public symbols can be found.
A. C++ is a strongly typed language. In order to support the language
to its fullest, Turbo C++ must attach information to the symbols
generated for function names and variables. When this is done, the
symbol will no longer match the standard C style function name. In
order to link correctly, the compiler must be notified that the symbol
is declared in an external module without type information tacked on
to the symbol. This is done by prototyping the function as type
extern "C". Here is a quick example:
No comments:
Post a Comment