Managed C++ Wrapper 
Author Message
 Managed C++ Wrapper


I am trying to wrap a MFC DLL in a managed C++ wrapper so
I can access one of the functions in C#.

The whole solution compiles correctly and I can see and
enter the managed dll correctly.

But when I try to call the constructor of the unmanaged
DLL, I get the error:

An unhandled exception of
type 'System.NullReferenceException' occurred in

Additional information: Object reference not set to an
instance of an object.

The code for the whole managed part is pretty simple:

#include "stdafx.h"

// this is the unmanaged code in a MFC DLL
class CHilltopMgr
        void Init();
        virtual ~CHilltopMgr();


namespace Hilltop
        public __gc class mHilltop

                void test()
                        CHilltopMgr h; // Bombs here!!!!!


Any help would be greatly appreciated!!!

Mon, 18 Apr 2005 07:09:52 GMT  
 Managed C++ Wrapper
Thank you for your post, I will test the sample and try to reproduce the
same problem.
If you have the code, please attach to the post.

Best Regards

Jian Shen

This posting is provided "AS IS" with no warranties, and confers no rights.

Mon, 18 Apr 2005 16:41:20 GMT  
 [ 2 post ] 

 Relevant Pages 

1. managed C++ wrapper around unmanaged C++ classes: causing StackOverflow exception

2. Managed C++ wrappers for unmanaged C++ classes

3. Interface of Managed C++ wrappers

4. Managed C++ Wrapper for DLL

5. C# program hangs while loading managed C++ wrapper to existing dlls.

6. Calling Managed C++ Wrapper From C+ (Almost got it.)

7. C# program hangs while loading managed C++ wrapper to existing dlls.

8. Referencing data from unmanaged code to managed code in C++ Wrapper class

9. Managed C++ "wrapper classes" deployment problem

10. Tutorial wanted for using a managed C++ class wrapper

11. Creating a managed C++ class wrapper

12. Extended MAPI in c++ managed code wrapper


Powered by phpBB® Forum Software