4

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 ?

tommyk
  • 3,023
  • 5
  • 35
  • 58
  • http://stackoverflow.com/questions/479207/function-overloading-in-c – Johnny Mopp May 07 '14 at 12:53
  • 1
    C linkage implies no name-mangling. hence they would get the same name. – sp2danny May 07 '14 at 14:20
  • Possible duplicate of [error C2733 second C linkage of overloaded function 'function' not allowed](http://stackoverflow.com/questions/7840203/error-c2733-second-c-linkage-of-overloaded-function-function-not-allowed) – rold2007 Feb 05 '16 at 19:39

1 Answers1

9

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

Vlad from Moscow
  • 265,791
  • 20
  • 170
  • 303