[Ohrrpgce] Problem starting gfx_directx

Jay Tennant hierandel8 at crazyleafgames.com
Sun Dec 27 12:05:50 PST 2009


Follow up on a few items. I discovered GetProcAddress(), used in windows to get the address of an exported function in a dll, can also be used to get the address of an exported variable, according to:
http://msdn.microsoft.com/en-us/library/ms683212(VS.85).aspx

That functionality is not mentioned in the Windows SDK Nov 2008 docs. Also, it is possible to link to a dll during runtime even if using the pragma comment directive: use /DELAYLOAD linker option in msvc, according to:
http://msdn.microsoft.com/en-us/library/151kt790.aspx

From that doc, the app will only load the library when a function call is made, or a variable is accessed that resides in that dll.

> From: "Jay Tennant" <hierandel8 at crazyleafgames.com>
> Sent: Wednesday, December 23, 2009 1:44 PM
> 
> > From: Ralph Versteegen <teeemcee at gmail.com>
> > Sent: Wednesday, December 23, 2009 10:01 AM
> > 
> > 2009/12/24 Jay Tennant <hierandel8 at crazyleafgames.com>:
> > > There could be an additional dll that mediates between the program and gfx_directx.dll. I think it's just easier to use the static linking. The best solution would be to remove the d3dx dependency altogether by building an alternative to ID3DXFont and D3DXSaveSurfaceToFile().
> > 
> > Oh, that's the extent of it? Well, we don't need the fps display, we
> > already have ctrl+~.
> 
> You're right. It doesn't convey any useful information that the engine can't give, and it piles on quite a few kilobytes just to use. I'll remove it, as well as the checkbox in the Options dialog. Then we just have 1 function we're dependent on... for screenshots... Any suggestions?
> 
> > >> From: "Mike Caron" <caron.mike at gmail.com>
> > >> Sent: Wednesday, December 23, 2009 6:56 AM
> > >>
> > >> http://blogs.msdn.com/oldnewthing/archive/2005/02/14/372266.aspx
> > >>
> > >> That was a pain in the butt to find :/
> > >>
> > >> Anyway, read the comments too.
> > >>
> > >> --
> > >> Mike Caron
> > >>
> > >> -----Original Message-----
> > >> From: "Mike Caron" <caron.mike at gmail.com>
> > >> Date: Wed, 23 Dec 2009 12:38:50
> > >> To: <ohrrpgce at lists.motherhamster.org>
> > >> Subject: Re: [Ohrrpgce] Problem starting gfx_directx
> > >>
> > >> Shit, you replied after I left, and thus I can't link pertinent docs.
> > >>
> > >> Anyway, if DyLibLoad etc aren't working the way I mention, it's because FB is mangling it's wrapper around LoadLibrary or whatever the Win32 function is called.
> > >>
> > >> And, the flag you're talking about is deprecated, and when used is a ticking time bomb. Specifically it will blow up when you try to resolve any symbols in those dependencies!
> > >>
> > >> Google "old new thing DLL DEPENDENCIES" or something like that (no quotes), to find the relevant page on The Old New Thing.
> > >>
> > >> --
> > >> Mike Caron
> > >>
> > >> -----Original Message-----
> > >> From: Ralph Versteegen <teeemcee at gmail.com>
> > >> Date: Thu, 24 Dec 2009 01:30:38
> > >> To: <ohrrpgce at lists.motherhamster.org>
> > >> Subject: Re: [Ohrrpgce] Problem starting gfx_directx
> > >>
> > >> 2009/12/24 Mike Caron <caron.mike at gmail.com>:
> > >> > Ralph Versteegen wrote:
> > >> >>
> > >> >> 2009/12/23 Jay Tennant <hierandel8 at crazyleafgames.com>:
> > >> >>>>
> > >> >>>> From: Ralph Versteegen <teeemcee at gmail.com>
> > >> >>>> Sent: Tuesday, December 22, 2009 10:35 PM
> > >> >>>> 2009/12/23 James Paige <Bob at hamsterrepublic.com>:
> > >> >>>>>
> > >> >>>>> I was just testing out a windows build with gfx_directx gfx_sdl on a
> > >> >>>>> computer with directx 9.0c installed (according to dxdiag). When I run
> > >> >>>>> game.exe it says:
> > >> >>>>>
> > >> >>>>> "This application has failed to start because d3dx9_41.dll was not
> > >> >>>>> found. Re-installing the application may fix this problem."
> > >> >>>>>
> > >> >>>>> When I click okay on it, then game.exe starts up okay falling back on
> > >> >>>>> gfx_sdl
> > >> >>>>>
> > >> >>>>> Any idea why this might happen?
> > >> >>>>>
> > >> >>>>> ---
> > >> >>>>> James Paige
> > >> >>>
> > >> >>> d3dx9_41.dll is one of many dll's that microsoft has released to patch
> > >> >>> the d3dx library. A solution to this would be obtaining the latest dx
> > >> >>> runtime on your computer, available at:
> > >> >>>
> > >> >>> http://www.microsoft.com/downloads/details.aspx?FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&displaylang=en
> > >> >>>
> > >> >>> An alternative would be compiling the backend with static linking the
> > >> >>> d3dx library, which was available in the december 2004 dx sdk. This will
> > >> >>> remove dependencies, but will increase the dll size by about 500kb.
> > >> >>>
> > >> >>>> That's interesting, I was under the impression that loading
> > >> >>>> gfx_directx.dll would silently fail if its dependencies weren't
> > >> >>>> available. Luckily, it's quite simple to check in backends.bas whether
> > >> >>>> d3dx9_41.dll (the august 2009, I think, release of the Direct3D 9
> > >> >>>> utility library) is present before attempting to load gfx_direct.dll,
> > >> >>>> and I was originally planning to do.
> > >> >>>
> > >> >>> It's present in March 2009. I was trying to manually remove all
> > >> >>> dependencies, but got stuck with the screenshot and font algorithms.
> > >> >>>
> > >> >>> I'll upload a version of gfx_directx that has no dependencies in a few
> > >> >>> minutes, though 500kb larger.
> > >> >>
> > >> >> We ought to have some way to detect whether or not the dll has been
> > >> >> statically linked to d3dx9 or not. Would it be possible to set the
> > >> >> version number (the one seen in a the file browser) and read it
> > >> >> somehow?
> > >> >
> > >> > I haven't looked at this backend at all, so I don't know if this is already
> > >> > done, but the standard way of doing this (on Windows, at least) is something
> > >> > like this:
> > >> >
> > >> > hModule = DyLibLoad("gfx_directx.dll")
> > >> > hFunction = DyLibSymbol(hModule,
> > >> > "some_function_that_exists_in_d3dx9_41_dll")
> > >> >
> > >> > if hFunction != 0 then
> > >> >  'd3dx9_41.dll is statically linked
> > >> > end if
> > >> >
> > >> > DyLibFree(hModule)
> > >> >
> > >> > --
> > >> > Mike
> > >>
> > >> Well that won't work, because surprisingly windows pops up a message
> > >> box when the dependency is missing
> > >>
> > >> However, I saw a winapi function to load a dll without resolving its
> > >> dependencies (for the purposes of loading resources), probably that
> > >> can be used in the way you described.
> > >
> > >
> > > _______________________________________________
> > > Ohrrpgce mailing list
> > > ohrrpgce at lists.motherhamster.org
> > > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
> > > 
> 
> 
> 
> 
> _______________________________________________________
> Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting
>               http://www.doteasy.com 
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org 




_______________________________________________________
Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting
              http://www.doteasy.com 



More information about the Ohrrpgce mailing list