Reputation: 949
I am wondering if it is possible to pass my invoked C# object between c++ functions? I can already call my C# dlls from my native code, but now I need to pass a object between c++ functions which also means that I need to declare it in the header file...
When defining it in my header file I get the following error:
BOOL Exists(Api ^api);
Error 60 error C3395: 'ApiBase' : __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention
Does anyone know how I should handle this in my header?
Upvotes: 3
Views: 220
Reputation: 613592
You use __declspec(dllexport)
to export a native C++ class. But it sounds like your class is a managed .net ref class. If you wish to export the functionality for both managed clients and unmanaged clients you need to declare two classes. One a managed ref class, and one a native class.
Or perhaps the issue is that you are trying to export a function that has managed parameters with __declspec(dllexport)
. Again that is not possible.
Upvotes: 3