The gcc
tool chain is stricter than that of WINS/WINSCW
when
it comes to specifying exported functions. The correct way to export a function
from a DLL is as follows:
In the header file:
class CMyClass : public CBase { IMPORT_C void Function(); }
and then in the CPP file:
EXPORT_C void CMyClass::Function() { }
The WINS/WINSCW
tool chain does not mind if the EXPORT_C
is
excluded from the CPP file; it exports the function anyway. However, the gcc
tool
chain requires the IMPORT_C
and EXPORT_C
to
be perfectly matched. If they are not, the function will not be exported from
the DLL, which will eventually lead to errors such as "Cannot Find Function"
when attempting to link to this DLL.