RE: [GD-Windows] GetProcAddress()
Brought to you by:
vexxed72
From: Grills, J. <jg...@so...> - 2001-10-17 16:13:55
|
I do pretty much the same thing -- I have a render layer that I explicitly load from a DLL. One of my problems was that I needed my renderer to be able to use a few functions out of the application that loaded it (warning logging, etc). It's actually possible to have a DLL load symbols from an executable, but the executable name has to be known at link time. The problem I ran into is that I wanted to be able to use this one rasterizer DLL with multiple executables (the game itself, world builder tools, asset viewers, etc). I did some research and ended up using the techniques involved in hooking DLL functions to actually allow the DLL to rebind the imported functions into the executable that loaded it. Very nifty. If anyone wants more info, I'd be glad to type some more stuff up. It took me several days to figure out this trickery, but in the end it cleaned up a lot of crufty code. jefftep Jeff Grills Star Wars Galaxies Technical Director, Austin Studio Sony Online Entertainment Inc. -----Original Message----- From: Erwin de Vries [mailto:er...@vo...] Sent: Wednesday, October 17, 2001 4:58 AM To: Gamedevlists-Windows@Lists. Sourceforge. Net Subject: Re: [GD-Windows] GetProcAddress() > A perhaps better way of using DLLs is to have each DLL export one factory > function for the kind of services it implements, and return an interface > implementing all the services. All function calls into the DLL will then be > routed through this one interface. The interface could consist of a simple > aggregation of a procedural API, or factory functions for the kinds of > classes the DLL exports, or something fancier (such as something you can > query for other interfaces by name). In effect, you'd be hand-rolling > something COM-like, without the additional management/installation overhead > of COM. Yes! Thanks for the idea. I just tested it, and it is exactly what i wanted, except for the factory create function, but i can obviously live with that. =) I knew there must be some way to use DLL's in a normal manner. > Another approach, if you don't need the run-time loading, is to just let > your app link against the .LIB link library at link time, and reference all > the functions directly. This is still a win compared to statically linking > everything if you expect some parts of the system to rev much more often > than others. Thats not what i want, because i want to dynamically link to our renderer. Erwin |