I was actually just making a wierd solution around the fact that I can't install the dxsdk for real. Here's this little nested class I made to handle raii of a loaded library. It has a totally wierd ass design, it's just making up wierd solutions as I go along.
Code:
struct f
{
HMODULE l;
f( LPCTSTR lib, LPCSTR foo, LPCSTR bar ) throw(...)
{
if( l = ::LoadLibrary( lib ) )
{
XD3DXMatrixTranslation = reinterpret_cast<D3DMATRIX * ( WINAPI * )( D3DMATRIX *, float, float, float)> ( ::GetProcAddress( l, foo ) );
XD3DXMatrixPerspectiveFovLH = reinterpret_cast<D3DMATRIX * ( WINAPI * )( D3DMATRIX *, float, float, float, float )>( ::GetProcAddress( l, bar ) );
if( !XD3DXMatrixTranslation || !XD3DXMatrixPerspectiveFovLH )
{
throw std::exception();
}
}
else
throw std::exception();
}
~f(void)
{
::FreeLibrary( l );
}
} t;
Then I construct it something like
Code:
t( TEXT("H:\\d3dx9d_31.dll"), "D3DXMatrixTranslation", "D3DXMatrixPerspectiveFovLH" )
XD3DXMatrixTranslation and XD3DXMatrixPerspectiveFovLH are static class fields and usage of the class kind of depends on them. Oh wait, I just realized, the exception would fall through and the construction of the object would fail and I would be able to deal with things. I think that's good. Okay good.