Is there a way to use C++ (dll?) and C# together?

Discussion about everything. New games, 3d math, development tips...
Post Reply
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Is there a way to use C++ (dll?) and C# together?

Post by MasterGod »

I want to use C++ for graphics and C# for everything else.
I need to go so I'll be quick;
My friend and I are making an application and I want to make the graphics in C++ - OpenGL (me) and the logic in C# (him).
Windows only is fine, we don't need cross platform capabilities. We are doing everything from scratch without any external library (like Irrlicht/CsGL etc.). I can use Only what is provided with VS2005 and only media files can be imported to our workplace. It suppose to be a pretty small but impressive project, its for a contest. (Probably would be a small card game or something like that but with cool impressive features, gameplay-wise and programming-wise; OOP, efficiency etc..).

Is it possible to do that?

My idea was to make a dll with C++ with all the classes I need, to do the graphics and provide an interface for the C# application that uses my dll.
The first problem that I can think of is how to use the dll in C# syntax-wise.

Any other suggestion is welcome!

Thanks!!

P.S
Am I asking how to write a wrapper to OpenGL for C#?? :P

Oh and I'll check this thread only tomorrow midnight or day after tomorrow cause I have a 9 hours programming exam tomorrow :shock: :lol: . I love the army 8).
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I would say no, you can't do that, you'd need a C# wrapper around the C++ stuff, or vice versa maybe.

But i dunno, maybe it's possible... there's .NET, which i know very little about, but which may allow this sort of thing possibly?
Image Image Image
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

And neither of you could use google because..?

http://www.adp-gmbh.ch/csharp/call_dll.html
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I didn't use google because it's not my problem, MG didn't use google because he shoots first and asks questions later ;) heh

Nice catch Dorth.
Image Image Image
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Thanks. I don't use google cause I'm in the in the army and I don't have access to the internet there. When I do I have little time.
So you can ask what good is that information to me? I can print it and read it while I'm in the base, I have quite a lot of free time there. (And access to a computer to test it etc.. [vs2005])

Thanks again!!
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Mainnnn; err I mean Mannn..This code looks so ugly. I just read it and to use the dll in C[rap]# I need to do so many ugly things and this is only a simple program.

Unless there's some other nicer way I think I'm gonna neglect C# for anything but what I need for in the army.. :?

Microsoft and their stupid ideas.. Sigh.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Post Reply