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

[.net] Unmanaged C++ with VB.NET

Started by Webbster Feb 27, 2005 at 1:54 PM 4 replies 2k views
Original Post
Webbster
Webbster
What's involved in creating an editor's interface in VB .NET but allowing it to read/write and edit map files for my C++ games. I figured I would have to write a C++ DLL, and let my VB .NET project link to that DLL? Ideally the editor would be an MDI, so would it be possible to create a C++/Win32 Window Class inside my DLL and get VB to create an instance of that window as a child? Are there any decent tutorials on this subject, I can only seem to find ones concerning either C# or Managed C++ with VB .NET!
Promit
Promit
Look into P/Invoke.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
ernow
ernow
In VB .NET you use the Declare statement to access unmanaged code.
When the unmanaged code is COM code you should also take a look at the tlbimp.exe tool which creates an interop assembly.

Cheers
Lionheartadi
Lionheartadi
Try this document. I know it is in MC++ but it should offer some help, or atleast some keyword from which you can search more info.

http://www.gotdotnet.com/team/cplusplus/articles/mcmigrate.doc

Or just simply go to gotdotnet.com, they have a nice collection of sample code etc...

http://www.gotdotnet.com
Or this one... here you can find lots of articles with source. Maybe theres more help there.
http://www.codeproject.com/

I would give more info about using unmanaged C/C++ code in managed apps(for .NET). I have done it myself, but only in MC++. The rule still is that you can apply same methods in VB .NET, C# or MC++. Thats why I gave you the first link. Read it and use the Visual Studio documentation. Thats how I got started.
Adrian Simionescu
alexmoura
alexmoura
Not sure if I understand what you want to do - if the format of the maps is well known, your editor could just output it, you don't actually need to go around interoping between languages. You just need to make sure that both write/read the same binary format from the map files...

If that's all you want to do, check the file IO functionality on the framework, and maybe the Runtime.InteropServices.StructLayoutAttribute attribute.

That said, it might be easier to create a C++ library, expose a managed C++ interface on top of it and reference it from VB .Net, as sugested above.
Webbster
Webbster
Thanks for the help, that should be all I need!

Topic Locked

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

Sign in to reply to this topic.