473,394 Members | 1,739 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.

Importing a VC++ class into a C# program

Hi

I had a couple of questions:

1.)I am trying to invoke member functions of a class which is coded in
VC++ from a UI that is coded in C#. Firstly, if I am not mistaken I
think this can be done only if the exposed classes are managed. I am
totally new to this. So can someone give some pointers or maybe some
URLs to links on how this can be done - that is how to firstly be
able to export the classes and also how to make them managed/write
managed wrappers for the class.

2.)Once the VC++ coding is done, how do I invoke the member functions?
How do I instantiate an object of the VC++ classes in the C# code. It
would be great if someone could post some links to good articles that
deal with this.

Thank you.
Nov 16 '05 #1
1 1558
1) You can't directly expose a native interface to managed code, your only
option is to use "Managed Extentions C++" or VS2005's C++/CLI to wrap a
managed reference class around your native class and populate it with stub
methods that invoke the associated native methods.
2) Invoking the methods is done by simply invoking the stubs.

Willy.
"Rookie" <do***********@rediffmail.com> wrote in message
news:cf**************************@posting.google.c om...
Hi

I had a couple of questions:

1.)I am trying to invoke member functions of a class which is coded in
VC++ from a UI that is coded in C#. Firstly, if I am not mistaken I
think this can be done only if the exposed classes are managed. I am
totally new to this. So can someone give some pointers or maybe some
URLs to links on how this can be done - that is how to firstly be
able to export the classes and also how to make them managed/write
managed wrappers for the class.

2.)Once the VC++ coding is done, how do I invoke the member functions?
How do I instantiate an object of the VC++ classes in the C# code. It
would be great if someone could post some links to good articles that
deal with this.

Thank you.

Nov 16 '05 #2

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

Similar topics

1
by: Geoff Turner | last post by:
Hi all, OK, I have a DLL program that contains a couple of classes. There are two things I would like to know: 1: How do I export a class from a DLL 2: How do I import the class into VB6? ...
2
by: Serengeti | last post by:
Hello, in my class I have a map that translates strings to pointers to some member functions. The code goes like this: class F { typedef void (Function::*MathFuncPtr)(); std::map<std::string,...
0
by: Rookie | last post by:
Hi I had a couple of questions: 1.)I am trying to invoke member functions of a class which is coded in VC++ from a UI that is coded in C#. Firstly, if I am not mistaken I think this can be...
2
by: Rookie | last post by:
Hi, I have a DLL written in VC++ which exports a class. I want to import this class into a C# application and be able to instantiate it in the C# code. Is it possible to do this? If yes, is...
0
by: Scott Chang | last post by:
Hi all, I tried to use Managed C++ coding of VC++.NET (2002)and OpenGL version 1.2 to draw a hexagon shape of benzene. My OpenGLdrawBenzene.cpp is the following: // This is the main project file...
5
by: Hari | last post by:
Guys please help me to solve this strange problem what Iam getting as follows.. Trying to instantiate a global instance of a template class as follows :- when i build this code with debug and...
0
by: Ivan Lam | last post by:
Hi All, Thanks for reading my question. I am a newbie of VC .Net, and I am facing a problem about importing DLL. I have searched from the web and I download a simple sample. And the code...
14
by: Jeffrey Baker | last post by:
Hello, I wrote a program way back when VC++ 5.0 was around and when using this program in VC++ 2003 I get garbage. I was able to let the program run through code that would view the data. Since...
4
by: kurt.kurtsmith | last post by:
I am trying to import a tlb from a COM server(exe) I wrote with the following statement: #import "C:\\em2\\EM\\src\\core\\UMOSEFax\\Debug\\UMOSEFax.tlb" no_namespace auto_search the tlh and...
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
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.