473,386 Members | 1,674 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,386 software developers and data experts.

Using C# DLL in VC++ 6

Hi all,

I'm trying to use a C# DLL in VC++ 6. From reading a few articles I have
read that it is possible by using COM. I have created a simple class in
C# and created a type library using tlbexp.exe and imported it in my C++
source code, but I can't work out how to use the objects from my class.

My C# class is simple:

public interface ISimpleClass {
int test(int a);
}

public class SimpleClass : ISimpleClass {
public SimpleClass() {
}

public int test(int a) {
return a;
}
}

Any hints/help would be highly appreciated. I'm going mad here! :)
May 4 '06 #1
5 1321
Try

regasm /tlb youCSharpLib.dll

This will generate the TLB and do the COM registry entries.

Marcus Heege


"llihp" <ph**********@hotmail.com> wrote in message
news:MP************************@news.ntlworld.com. ..
Hi all,

I'm trying to use a C# DLL in VC++ 6. From reading a few articles I have
read that it is possible by using COM. I have created a simple class in
C# and created a type library using tlbexp.exe and imported it in my C++
source code, but I can't work out how to use the objects from my class.

My C# class is simple:

public interface ISimpleClass {
int test(int a);
}

public class SimpleClass : ISimpleClass {
public SimpleClass() {
}

public int test(int a) {
return a;
}
}

Any hints/help would be highly appreciated. I'm going mad here! :)

May 4 '06 #2
Hi, thanks for the reply.

I've done that bit already, I'm having trouble working out how to
instantiate and make use of the object in VC++.
"Marcus Heege" <NO****@heege.net> wrote in message
news:O0**************@TK2MSFTNGP03.phx.gbl...
Try

regasm /tlb youCSharpLib.dll

This will generate the TLB and do the COM registry entries.

Marcus Heege


"llihp" <ph**********@hotmail.com> wrote in message
news:MP************************@news.ntlworld.com. ..
Hi all,

I'm trying to use a C# DLL in VC++ 6. From reading a few articles I have
read that it is possible by using COM. I have created a simple class in
C# and created a type library using tlbexp.exe and imported it in my C++
source code, but I can't work out how to use the objects from my class.

My C# class is simple:

public interface ISimpleClass {
int test(int a);
}

public class SimpleClass : ISimpleClass {
public SimpleClass() {
}

public int test(int a) {
return a;
}
}

Any hints/help would be highly appreciated. I'm going mad here! :)



Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
May 4 '06 #3
> Hi, thanks for the reply.

I've done that bit already, I'm having trouble working out how to
instantiate and make use of the object in VC++.


Hi,
this link provides an example on consuming a .NET component as a COM object
in C++.
http://www.codeguru.com/csharp/cshar...cle.php/c4263/

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"

May 4 '06 #4
Cheers, I'll have a read through and give it a go. :)

"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:1F**********************************@microsof t.com...
Hi, thanks for the reply.

I've done that bit already, I'm having trouble working out how to
instantiate and make use of the object in VC++.
Hi,
this link provides an example on consuming a .NET component as a COM

object in C++.
http://www.codeguru.com/csharp/cshar...cle.php/c4263/

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"


Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
May 4 '06 #5
Excellent, just had a go and managed to get something working.

Thanks for that, much appreciated. :)
"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:1F**********************************@microsof t.com...
Hi, thanks for the reply.

I've done that bit already, I'm having trouble working out how to
instantiate and make use of the object in VC++.
Hi,
this link provides an example on consuming a .NET component as a COM

object in C++.
http://www.codeguru.com/csharp/cshar...cle.php/c4263/

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"


Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
May 4 '06 #6

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

Similar topics

34
by: Dennis | last post by:
I would like to dynamically allocate in a sub a 2 dimensional Array float *myarray = new float ; of course I get an error. How do you allocate a 2D array using the New operator? I...
11
by: Tatu Portin | last post by:
Have this kind of struct: typedef struct { char **user_comments; /* ... */ } vorbis_comment; /* prototype */ char * read_vorbis_string ( FILE *sc);
4
by: Anthony Gallagher | last post by:
I have a bunch of libraries compiled using VC++ 6.0, and I am trying to recompile one of our projects using VC++ .NET. I get all kind of linker errors (specially in STL calls). How do I get rid of...
11
by: Paul Tremblay | last post by:
Hi, I can't seem to locate the visual C++ (pre .NET) ng. This may be slight off topic here - please point me to the correct ng if it is. Without going into much detail (and repeating myself...
0
by: vishal.nagota | last post by:
I'm making a project on vc++ express I want to plot graphs, so using MSChart evrything goes fine, till i come to point where I've to include afxdisp.h by defualt i'm using Project properties...
4
by: Praveen Chandra | last post by:
Hi, I just wanted to put down the issue with more detailed information so that you can help us get to the right Microsoft resource for a solution! Here is the problem description... Our...
0
by: castratroi | last post by:
Hi, I have created a VC# dll using Visual Studio 2005, and I am using it in VC++ project(again created in Visual Studio 2005). For using this dll I simply add #using <mscorlib.dll> to the...
10
by: albert.neu | last post by:
To what extent does Microsoft Visual C++ also called: VC++ also called: Microsoft (R) 32-bit C/C++ Optimizing Compiler support C99? VC++ compiles either in C mode (which is def. *not*...
7
by: Rahul | last post by:
Hi Everyone, I have the following code, void f(int &) { printf("in f...\n"); } #ifdef __cplusplus
3
by: vrsathyan | last post by:
Hi.., While executing the following code in purifier.., std::vector<int> vecX; vecX.clear(); int iCount = 0; { int iVal;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.