Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why "second C linkage of overloaded function" is not allowed?

Tags:

c++

c

extern

dll

I converted my C++ dll to C dll:

#ifdef __cplusplus
    extern "C" {
#endif

MY_EXPORT int  my_func();
MY_EXPORT void my_func(int n);

#ifdef __cplusplus
    }
#endif

Everything worked fine without extern C declaration. With this declaration I got

error C2733: second C linkage of overloaded function 'my_func' not allowed

Why is it not allowed to export overloaded functions from C-style dll ?

like image 885
tommyk Avatar asked Jan 11 '23 15:01

tommyk


1 Answers

C does not allow to overload functions. That is C does not support overloading. It is a feature of C++.

like image 141
Vlad from Moscow Avatar answered Jan 24 '23 19:01

Vlad from Moscow