Pregunta

I'm trying to write a wrapper dll in C++/CLI to use some native classes in c#.

For Testing I created another C++/CLI Project that consumes the dll.

My Problem is, that I would like to use one of the native classes in the dll project in the test project, but the linker complains that it does not find the symbols for this class members. I guess it's because the native class is not defined ref public. As the native class code is auto generated by the Google Protobuffers compiler I can not add ref public to it.

Don't misunderstand me, I don't want to use this native class in the future c# project but I want to directly access it in the Test project.

¿Fue útil?

Solución

I think you have to follow the typical native c++ way of doing this: export the class from the dll, link against the dll from the test project, and then #include the header file from the test project where you need to use the class.

I don't think there is a "managed way" to reference and use a native class (hopefully others will correct me if I'm wrong).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top