• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
myvraccount

References and Environmental Variables

8 posts in this topic

I'm trying to do various things in .NET which require DLLs and similar libraries to be imported, and environmental variables to be set.  Honestly, I never had to do this very much, and it's been a long time, and now I'm using Visual Studio 2012, and the interface is a bit different.  Here are my problems:

 

-  I can't find where/how to set environmental variables.  I could even hard-code them into a file if I need to, if someone tells me exactly what file and what to put where, but there should be a way to do it easier through the IDE.

 

-  I can't seem to add DLL references.  I have some projects that already have references in them, but I don't remember how I added them.  Now it seems that if I click the references from the menu bar, it doesn't have a browse button in any of my new projects, and sometimes the references option isn't even on the menu at all!  I don't know if this depends at all on what type of project I start (empty, Windows app, etc.), or what language I use, or any other considerations, but it's very inconsistent.

 

I want to ultimately be using C#, but I think I need to start with C++ for compatibility with the DLLs, then make a wrapper to use in C#.  Also, I've no experience doing that, so if anyone has any info about it, it would be appreciated.

 

Thanks.

0

Share this post


Link to post
Share on other sites

What do you mean "evnironmental variables"? Are you referring to the system environment variables? They're generally set from the System Properties dialog on the control panel. If you want to to write them programmatically well LMGTFY.

 

As for references, right click on "references" under your project in the solution explorer and click "add reference". If you're still having trouble with that, come back with a more specific question.

 

Finally, there are several ways to use a C++ lib/dll, but IMO, the best way is to use C++/CLI to wrap the library and provide CLR classes that can be used from C# (F# or VB.net or whatever other .Net language you like)

0

Share this post


Link to post
Share on other sites

I guess I thought there was a way to set the environmental variables somewhere in the project settings.  It hadn't occurred to me to do it programmatically, but I'll test that, and if it works, I'll just do it that way.

 

That's how I was trying to add references, but when I click the "Add New Reference" button, a window pops up which is supposed to have a list of DLLs or LIBs, but it's empty, and I have no way of browsing in that or the previous window.  The problem is inconsistency between projects.  Some projects have certain menu options, and buttons and lists available in certain windows, and other projects do not, and I can't see why that would be.

 

As for wrapping C++ for C#, I guess what I'm trying to do is: once I have the libraries I need imported into a C++ project, I want to make new functions for a better interface, and one that I can compile into a DLL that is compatible so I can import it into C#.  Basically I'm trying to use code that was written in C++ and intended to be used in C++, and make a wrapper so I can use it in C#, but I've never done anything like that before, so I don't know how.

 

Thanks for the info btw.

0

Share this post


Link to post
Share on other sites

First off, it's environment variables, second, why don't you just put the dlls in the project folder directory?

0

Share this post


Link to post
Share on other sites

Which folder exactly?  The one with the .sln, .suo and .sdf files, or the one with the .vcxproj, .filters and .users files?

 

If I put it in the right folder, will it show up on the list and then I don't need to browse anyway?

0

Share this post


Link to post
Share on other sites


Which folder exactly? The one with the .sln, .suo and .sdf files, or the one with the .vcxproj, .filters and .users files?

 

Im not exactly sure since i generally uncheck the "create directory for solution" box when i create new projects. I think you can find it by going to the project configuration dialog, in project->project property->configuration property->debugging->working directory. You should see $(ProjectDir) in the box, click the browse... option and you should see what directory it use.

 

When deploying the program, it's a lot simpler, just drop the dlls in the same folder as the executable, it will try to find them there first. If it can't find them it will check the windows and windows/system32 directory, then the environement variables.

1

Share this post


Link to post
Share on other sites

Well I finally got it to import and recognize a DLL reference (which wasn't easy!  Jesus, Microsoft, can't you make a consistent interface?!) but then of course when I try to call a function I get a compilation error that says the DLL is corrupt or something, which I know isn't true, because I just downloaded it fine, and it's widely used, so there can't be a problem with it.  Also, it comes with a sample program that uses the DLL and doesn't have any errors.

 

I haven't gotten around to trying to set the environment variable yet, because I can't get the DLL to work anyway.  Also, I worry about whether the problem may be that the environment variable is not set, and that's causing it to somehow not recognize the DLL (I'm not sure exactly why the environment variable does, or for that matter, what they're supposed to do in general), but if this is the case, I'd need to set the environment variable before runtime, and the runtime function would not be applicable.

0

Share this post


Link to post
Share on other sites

To set an environment variable, go to Control Panel/System and click on Advanced System Settings, then on the Environment Variables button. If you can't figure out what to do from there, programming is probably not for you :)

 

As for the dll, what dll is it? Is it a /net assembly or a native dll? Do you have all the dependant dlls?

 

Google "dependency walker" and load the dll into that, it will show you if you're missing anything.

 

Don't take this the wrong way, but you're asking some pretty basic questions. There's nothing wrong with that, but you might want to start with an easier project.

0

Share this post


Link to post
Share on other sites

Oh, yeah I've seen that on the system properties page, but I didn't realize I was supposed to set the environment variable for the whole computer, I thought it was just for the project.

 

As far as I know it's a regular compiled DLL, because it's intended to be used in C++, but I'm using it in C++ .NET, though I'd like to wrap it so I can use it in C#.

 

I'll try that.  Unfortunately I don't think I'll have time to work on it any more until the weekend, as I have other obligations.

 

I know you don't mean any thing condescending, and I know you're trying to help (which you are doing BTW and I appreciate it) but let's get something strait.  I'm not "starting" with any project; I've been writing code for over 20 years, in everything from C++ to .NET to Java to Lisp to Prolog to Eiffel for God's sake.  I've done AI, compression algorithms, cryptography and just about anything else you can think of.  I don't meant o brag but you get my point, right?  It's just that usually I don't have to rely on anything third party, beyond the built-in code libraries for a language.  I don't think I've ever had to set an environment variable, and I haven't used DLLs since earlier versions of .NET, in which the interface was different, and frankly I'm not entirely sure I remember how I did it.  And for some reason, the stupid .NET interface is inconsistent (I get different menu options in different projects, and the windows have different buttons).  Also, I don't know why, but whenever I try to search for relevant info, especially for the specific DLLs I'm using, I don't find anything useful.  If I have a noticeable flaw, it's that I'm not good at finding info online.  For some reason, I search and fail to find anything useful, which is why I came here.  Usually it's not a big deal though, because most of what I typically do is just plain logical/mathematical programming, where all I have to understand is the pure language itself and deductive reasoning - nothing more, which is the way I like it, but in this case, I have to rely on other means.

 

Anyway, I'm not entirely convinced that the DLL isn't somehow corrupt, because it said there was an error using it (I don't remember the error off hand), but I don't see how it could be corrupt, since I downloaded it successfully from a widely used public website, so that makes me think that maybe I'm doing something wrong, despite the fact that I included it into my project supposedly correctly.

-1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0