ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  Intro to Managed C++, Part 2: Mixing Managed and Unmanaged Code
Subject:   Why C#?
Date:   2008-02-03 06:41:10
From:   ailyag
Response to: Why C#?

Hello everybody!
I've got the concept you discuss.
But I have difficulties with using C++ managed DLL in C#.
There is no problem call just a funtion from DLL by declaring as follows:
[DllImport("CFS01.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern MyClass unmanagedMethod(float x, float y);

But I have difficulties in working with the instance of managed class in C#. I cann't call the member functions of class without declaring its body.

In my DLL I have managed class which wraps the unmanaged one and operates with it.

How should I adapt my managed class for my application?
How should I make visible my managed class with all its member functions without declaring?

Can you show a simple example of similar situation solved?
I guess that it may be the configuration problem.

Thank you for help!