• 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
helix

#pragma comment(linker,"/delayload:xxx.dll") -- not supported in VS .NET

10 posts in this topic

The codebase I'm stuck using uses this pragma several times (for directx and other things). Their reasoning is because it will allow the plugin to still load even if you don't have the correct version of directx installed. This way it can be handled by telling the user what the problem is and how to resolve it. [This is something I'd REALLY like to be able to do with my games going forward so I can do away with a separate launcher exe that does this check for me.] So anyway, it appears that it is no longer supported post VS6.0 and after browsing the web for an explaination, it sounds like it never really was guaranteed to work in the first place so they just cut it. This isn't going to be a showstopper for me but it would sure be nice if there was a way to handle it. What can I do to gain this functionality? My project here is to create a plugin dll for another app and if you don't have every single dll installed, it simply won't show up in the plugin list at all currently -- not very elegant. Thanks!
0

Share this post


Link to post
Share on other sites
You'll have to write code that defers runtime linking till later. And that'll probably mean setting up function pointer declarations and using LoadLibrary/GetProcAddress.

(If you don't already know this, LoadLibrary takes a path or filename of a DLL and returns a handle. GetProcAddress takes that handle and the function name and provides you with a pointer to the function. You assign that to a function pointer variable with the correct definition for the function in the DLL and you're good to go. Get it wrong and you'll almost certainly go down in flames)

One way to do this is to wrap those function pointers in another function in your dll (or in a macro) and check the pointer for null. If it is, then you GetProcAddress and hook up etc. At this point you could raise an exception or whatever if LoadLibrary or GetProcAddress return null or there was some other problem you detected. You could also just link everything all at once in whatever context makes the best sense.

If you're talking about dlls with just a handful of exports you want to link, this is no big deal. But for DirectX itself, you've got some fairly heavy lifting to do.

The basic problem is that if you let the OS do this runtime linking for you, it will succeed or fail before execution ever gets to code you have any control over (there may be some way to get your own code in even earlier but I sure don't know what it is)

I've never heard of that pragma before and I don't know what it does. It might set up something like what I described above with those macros.
0

Share this post


Link to post
Share on other sites
That sounds like a huge pain in the ass and was about what I was expecting. I'll mark that one as "if time". Thanks for the input.
0

Share this post


Link to post
Share on other sites
The conversion of function prototypes to function pointer declarations is pretty trivial and can be done with fairly simple text processing. But there's no really slick, easy way to automatically code the hookups - at least none I've come up with before running out of steam on the effort.
0

Share this post


Link to post
Share on other sites
I'm using Visual C++ .NET 2003 Enterprise Architect, and setting a delay-load DLL worked perfectly fine.
0

Share this post


Link to post
Share on other sites
Quote:
The conversion of function prototypes to function pointer declarations is pretty trivial and can be done with fairly simple text processing. But there's no really slick, easy way to automatically code the hookups - at least none I've come up with before running out of steam on the effort.

Here's how:

// glext_funcs.h
FUNC(int, wglSwapIntervalEXT, (int))

// declaring function pointers (this goes in a header)
#define FUNC(ret, name, params) extern ret (CALL_CONV *name) params;
#include "glext_funcs.h"
#undef FUNC

// importing them
// note: can also use GetProcAddress(hDLL, #name)
#define FUNC(ret, name, params) *(void**)&name = SDL_GL_GetProcAddress(#name);
#include "glext_funcs.h"
#undef FUNC


HTH+HAND
0

Share this post


Link to post
Share on other sites
Thanks Jan, I'll look into that.

Quote:
Original post by trevaaar
I'm using Visual C++ .NET 2003 Enterprise Architect, and setting a delay-load DLL worked perfectly fine.


I assume you're building with the VC7 libs and runtimes? Are you using the pragma as I have in my subject line? I'm wondering how it works for you because I read online that it was specifically taken out of VS .NET.
0

Share this post


Link to post
Share on other sites
The /delayload:foo.dll linker command line switch is supported even in the VC++ 2005 beta. Works fine for me.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Arild Fines
The /delayload:foo.dll linker command line switch is supported even in the VC++ 2005 beta. Works fine for me.


So you're not using the pragma but actually putting it in your project settings? Where would I put that? The command line is read only.

Maybe they put the functionality back in for 2005. Does it work for you in 2003?
0

Share this post


Link to post
Share on other sites
Quote:
Original post by helix
Quote:
Original post by Arild Fines
The /delayload:foo.dll linker command line switch is supported even in the VC++ 2005 beta. Works fine for me.


So you're not using the pragma but actually putting it in your project settings?

Yes.
Quote:

Where would I put that?

Project Properties->Configuration Properties->Linker->Input->Delay Loaded DLLs
Quote:

The command line is read only.

You don't have a white "Additional options" box there?

Quote:

Maybe they put the functionality back in for 2005. Does it work for you in 2003?

Yes. And in 2002.

0

Share this post


Link to post
Share on other sites
Wow, I can't believe I didn't notice that line for delay loaded dlls! That appears to work (no more warnings) but I won't know for sure until I'm at a point where I can run this thing.

I did find the additional options edit box...I don't know how I missed it before. :
Thanks
0

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