| description | Learn more about: Exporting C++ Functions for Use in C-Language Executables | ||||
|---|---|---|---|---|---|
| title | Exporting C++ Functions for Use in C-Language Executables | ||||
| ms.date | 11/04/2016 | ||||
| helpviewer_keywords |
|
||||
| ms.assetid | 80b9e982-f52d-4312-a891-f73cc69f3c2b |
If you have functions in a DLL written in C++ that you want to access from a C-language module, you should declare these functions with C linkage instead of C++ linkage. Unless otherwise specified, the C++ compiler uses C++ type-safe naming (also known as name decoration) and C++ calling conventions, which can be difficult to call from C.
To specify C linkage, specify extern "C" for your function declarations. For example:
extern "C" __declspec( dllexport ) int MyFunc(long parm1);