Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. cplusplus.h
  2.  
  3. #ifndef CPLUSPLUS_H
  4. #define CPLUSPLUS_H
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. "#endif"
  9.  
  10. void Foo(A a);
  11. void Foo(B b);
  12.  
  13. #ifdef __cplusplus
  14. }
  15. "#endif"
  16.  
  17.  
  18. cplusplus.cxx
  19.  
  20. #include "cplusplus.h"
  21.  
  22. extern "C" {
  23.  
  24. void Foo(A a) {
  25. print(a.some_member);
  26. }
  27.  
  28. void Foo(B b) {
  29. print(b.some_member);
  30. }
  31. }
  32.  
  33.  
  34. main.c
  35.  
  36. #include "cplusplus.h"
  37.  
  38. int main(int argc, char*argv[]) {
  39. return 0; //Even without calling the function, an error throws.
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement