| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Passing std::string to constructor of unmanaged class
Dear forum members,
I have an unmanaged dll (written in VC++ 6.0) that implements a class CUnmanaged. The class has the following constructor: CUnmanaged::CUnmanaged( const std::string& filename ) { /* ... */ } I have a client application (written in VC++ .Net) that uses the above class dll as follows: CUnmanaged* oserr = new CUnmanaged("error.out"); When the above line is executed, an assertion dialog is popped up: "An unhandled exception of type 'System.NullReferenceException' occurred in MyUnmanaged.dll Additional information: Object reference not set to an instance of an object." Can anyone tell me what is wrong with the code ? and how to solve the problem ? Thanks in advance. -Rajesh. |
|
#2
|
||||
|
||||
|
Re: Passing std::string to constructor of unmanaged class
Maybe you are causing an error in your constructor but likely try this:
Code:
CUnmanaged *oserr = __nogc new CUnmanaged("error.out");
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
|
#3
|
|||
|
|||
|
Re: Passing std::string to constructor of unmanaged class
__________________
Ciao, Andreas "Software is like sex, it's better when it's free." - Linus Torvalds Article(s): Allocators (STL) Function Objects (STL) |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|