Skip to main content
GameDev.net gamedev.net
🔒 Locked

VC++ / C# Integration Help

Started by alundgren Jul 3, 2008 at 3:56 PM 2 replies 950+ views
Original Post
alundgren
alundgren
Hello my minions, BACKGROUND I've been working on a game project for a while in vc++, so far have the graphics engine done. I've decided to switch to C# for game logic and networking, for speed of development. I want to keep the graphics unmanaged VC++ DX9, for performance. QUESTION I know you can reference unmanaged code (vc++) from managed (C#), and I want to do this with my graphics being in VC++ and my logic in C#. What are my options, what is recommended? I'd like to do this by making my graphics engine a DLL and referencing it from C#. Can this be done with the DLL exposing it's public interface as it normally would? I just need a quick overview of my options and how it would work, I can research the details myself. Also, any good links are appreciated. You may respond. __ Andrew
alundgren
alundgren

Thanks

What is your recommendation for a graphics engine - COM or DLL?

Pro/Con?
VizOne
VizOne
COM can be quite complex but it has the advantage that you can at least work with interfaces (as you might know from DirectX). Using DLLs with DllImport will restrict you to functions only, no classes etc.

But I'd suggest a third alternative: write a thin .NET wrapper in C++/CLI. C++/CLI can make use of both managed and unmanaged code. The C# project can then use the DLL written C++/CLI as if it was any other .NET code - this is extremely convenient. SlimDX is a superb example of an adapter library written in C++/CLI. It provides access to DirectX to any .NET project.

Regards,
Andre

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.