Steam Greenlight

Help pick new games for Steam

Browse through the entries here and rate up the games you want to see made available via Steam

Submit your product
PARADIGmSHIFT_x8 Sep 23, 2013 @ 7:54pm
DLL Wrapper
So from what I understand, one can create a game in any programming language and submit to steam, but in order to use steam's API, one would need write a DLL wrapper in C++ presumably.

With that said, can someone to point me to some simplified articles so I can understand what a dll is, what part of my code i need to wrap, and how to do it. My background is in web development and I've work with php, javascript and such, but software (or better yet, game) development is a whole 'nother beast with compilers, .exe .dll etc...

I haven't leant toward any programming language yet and quite frankly C++ scares the crap out of me so i wanted to look into something simpler like C#, Python, Haxe etc.... (any suggestions here would be nice as well). I'm not against learning C++ though. Part of me feels that its best to just suck it up and just learn the beast.

Anyways, I've check out a few articles and from what i can understand is: say we create a game in C#, so we have myGame.cs which will compile into myGame.exe and (here's where I'm guessing) we create a file called myDll.dll which contains functions written in C++ and then called in myGame.cs? If this is correct, do i write those same functions in C# within myGame.cs and call the .dll file?

Here's the link where i got some info from: http://cygwin.com/cygwin-ug-net/dll.html

If any anyone help me understand this properly? Possibly some sudo code would be great or even real code might even be better
Showing 1-3 of 3 comments
< >
AusSkiller Sep 24, 2013 @ 4:51am 
Originally posted by PARADIGmSHIFT_x8:
Anyways, I've check out a few articles and from what i can understand is: say we create a game in C#, so we have myGame.cs which will compile into myGame.exe and (here's where I'm guessing) we create a file called myDll.dll which contains functions written in C++ and then called in myGame.cs? If this is correct, do i write those same functions in C# within myGame.cs and call the .dll file?
That's pretty much it. A DLL is basically just compiled code that has an interface that lets other applications (and DLLs) use exposed functions that were in that code. The way it works when creating a wrapper for the Steamworks API is that you would get the Steamworks SDK which is written in C++, and create a new C++ project that will be compiled as a DLL and for each Steamworks function that you want to use you create your own function that calls the Steamworks one and expose your function as an interface to be used as part of a DLL. Then in other languages there should be a way to load up that DLL and use those exposed functions, unfortunately I deal mainly with C++ so I'm not familiar with the exact methods for doing that, but it shouldn't be too hard to find documentation on it though. The C++ knowledge you would need to write the wrapper DLL is pretty minimal and if you know other languages you shouldn't have much trouble figuring it out, though you'll want to brush up on memory use and object lifetimes in C++ to ensure you don't leak memory.

Personally I'd recommend just learning C++, it's a lot trickier to get started with because there's no hand holding in the language, but once you get used to the differences between pointers, references and values, and what implications are associated with their use, it's really not much more difficult than any of the other languages. Also it's a lot easier going from C++ to any other language than it is going from another language to C++, so if you learn C++ you can fairly quickly switch to a higher level language like C# or Java if it turns out that's what you would prefer to work with. But if you are eager to get something up and running quickly then other languages like C# can certainly be much better and these days the advantages of C++ aren't as important.
orb Sep 24, 2013 @ 5:10am 
Originally posted by AusSkiller:
Then in other languages there should be a way to load up that DLL and use those exposed functions
You can call functions from native (C++) libraries in the managed (C#) code with PInvoke[msdn.microsoft.com].
PARADIGmSHIFT_x8 Sep 25, 2013 @ 9:03am 
Originally posted by AusSkiller:
The way it works when creating a wrapper for the Steamworks API is that you would get the Steamworks SDK which is written in C++, and create a new C++ project that will be compiled as a DLL and for each Steamworks function that you want to use you create your own function that calls the Steamworks one and expose your function as an interface to be used as part of a DLL. Then in other languages there should be a way to load up that DLL and use those exposed functions

Thank you, that sums it up perfectly actually.

Also, I've actually read a few of your posts on the topic of using different languages with Steamworks' API. You seem quite knowledgeable on the subject, thank you.

Originally posted by orb:
You can call functions from native (C++) libraries in the managed (C#) code with PInvoke[msdn.microsoft.com].

That's beautiful documentation right there actually.

Originally posted by Mindwedge:
Part of me says you should listen to that part.

Yeah, based on yours and AusSkiller advice, I think I'm just going to learn C++. Might as well go all the way.
Showing 1-3 of 3 comments
< >
Per page: 15 30 50
Date Posted: Sep 23, 2013 @ 7:54pm
Posts: 3