"New" operator works in extern "C"
c#, c++, dll, extern
Solution
`extern "C"` doesn't change the compiler into a C compiler. It only says that any functions (or pointers to functions) will use the C conventions in their interface. So you can still do anything you could do in C++ in the functions; it's only things like name mangling and calling conventions which will be affected.
Problem
Im using a C++ DLL for my C# project, DLL has a class inside which is created and destroyed by outer functions such as: ``` class myClass { int N; public: //some elements and some functions myClass(int n) { N=n; } }; __declspec(dllexport) myClass * builderF(int n) { return new myClass(n); } __declspec(dllexport) void destroyerF(myClass * c) { delete c; } ``` and these are in extern "C" {} body. How does the compiler let me use C++ features is "C" space? Isnt it for only C code? This is tested and works(Ive started making an opencl wrapper for C#). I was using only pure C codes before.