I'm attempting to put a C# front end on my unmanaged C++ ray tracer code.
It's still in experimental stage, as I have never done anything with
exporting types from an unmanaged dll through to a managed C# dll before.
Currently, I have an unmanaged dll, a managed C++ wrapper dll and a C# dll.
I have managed to get enough exported from the unmanaged code to get a
vaguely correct picture on the screen, however there is some odd behaviour.
Firstly, I can't seem to get the debugging symbols to be loaded for the
unmanaged project. I have copied the .pdb file for the unmanaged project to
the directory where the C# executable is placed, but when I place
breakpoints in the unmanaged code, VS says the symbols have not been loaded.
The breakpoints work ok in the MC++ dll, and the C# dll, though.
Secondly, I get null reference exceptions from my GC wrapper classes when
they are trying to create an instance of the unmanaged type. For example:
WorldGC::WorldGC()
{
world = new World();
}
I get a null reference exception from that line. The constructor of the
unmanaged world class just sets a couple of integer values, nothing that
should generated a null reference exception. Because I can't get the
debugging to work, it's difficult to work out why the exception is
happening.
The last problem I have is that my unmanaged World class has a vector data
member. I don't know what syntax to use to export this type to the MC++ dll.
The compiler gives me this warning:
warning C4251: 'World::objects' : class 'std::vector<_Ty>' needs to have
dll-interface to be used by clients of class 'World'
with
[
_Ty=Shape *
]
How can I declare the objects member to be exported in my World header file?
Sorry if these problems are stupid, I'm kinda stumbling around in the dark
at the moment. Any help would be greatly appreciated.
Niall