473,394 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Difficulties exporting from unmanaged to managed C++

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
Nov 16 '05 #1
0 1465

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
6
by: Stijn | last post by:
Hi there, I have the following problem. At the moment I am creating an application that interfaces with several hardware modules via USB. Each of these devices has its own functionality and I...
4
by: Alexander Filatov | last post by:
I need implementing Windows Cluster Resource DLL, that requires me creating DLL exporting several functions. How it can be done in C#? Thanks, Alexander
6
by: Angel | last post by:
I'm exporting (with DllImport) a C-style function with this syntax: int z9indqry (4_PARM *parm); 4_PARM is a structure declared in a proprietary header file that cannot be included in my...
4
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that...
3
by: nikola | last post by:
is it possible to export (and, above all, import afterwards) an unmanaged class from a managed dll (compiled with the /clr switch. it would in fact probably result in a mixed mode dll)? it seems that...
0
by: Alessandro Angeli [MVP::DigitalMedia] | last post by:
I created the following DLL in managed C++: -------- export.cpp ----------- /// cl /clr /LD export.cpp /link /NOENTRY nochkclr.obj #using <mscorlib.dll> using namespace System; using...
7
by: Gustavo L. Fabro | last post by:
Greetings! Some classes that once compiled without problems on VS 2003 have now problems on VS 2005 Beta 1. I'm talking about a __nogc class that is exported with __declspec(dllexport). The...
1
by: Saad | last post by:
Hi, I have a MC++dll, whose functions i want to use in unmanaged c++. I read that one of the ways to use the managed functions in unmanaged world is by exposing the managed api as flat api. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.