Skip to content

DLL import

Bruce Barington

Asked Dec 14, 2010, 8:31 AM EST1 answer
Share
LinkedInX
I have a c++ code and it has some operator overload methods like operator ()
As far as I know () operator can not be used in C# directly (or indirectly).
Is it possible to import such a dll writen in C++ to C#? Can I still use () operator in C# if it is possible?
Example in C++:
Code
const MyClass MyClass::operator()(...) const {
...
  }

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Mike Gold
    0
    The cast operator cannot be overloaded in C#.  Does your dll expose an operator method?  I didn't think unmanaged dlls could expose classes to .NET applications, but I could be wrong.  You might be able to write a mixed-mode Visual C++ application that understands your operator()  and then provides a managed interface that works as a method instead.
    0