main.cpp
#include "main.h"
#include <windows.h>
//globals
typedef void (CALLBACK* MAKECUBE)(int,float);
MAKECUBE MakeCube;
// standard dll main entry point
BOOL APIENTRY DLLMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
if( ul_reason_for_call==DLL_PROCESS_ATTACH)
{
// start up proceedure
if( !SUCCEEDED( ProcessInitilise() ) )
return FALSE;
}
else if(ul_reason_for_call==DLL_PROCESS_DETACH)
{
// close down proceedure
if( !SUCCEEDED( ProcessRelease() ) )
return FALSE;
}
return TRUE;
}
int ProcessInitilise( void )
{
HINSTANCE hDLLBasic3D = LoadLibrary("DBProBasic3DDebug");
if(hDLLBasic3D != NULL)
{
if(!SUCCEEDED(MakeCube = (MAKECUBE)GetProcAddress(hDLLBasic3D,"?MakeCube@@YAXHM@Z")))
{
FreeLibrary(hDLLBasic3D);
return FALSE;
}
}
return TRUE;
}
int ProcessRelease( void )
{
return TRUE;
}
void MakeObjectCube( int iObject, float fSize )
{
MakeCube( iObject, fSize );
}
main.h
#include <windows.h>
// include library headers
#define DBPCOMMAND __declspec ( dllexport ) // export prototype
//decorated commands
DBPCOMMAND int ProcessInitilise( void );
DBPCOMMAND int ProcessRelease( void );
extern "C"
{
// undecorated commands
DBPCOMMAND void MakeObjectCube(int iObject,float fSize);
}
this should work... it compiles fine, i can't figure out why it doesn't - but when i run it, dbp just quits on me ... earlier was getting errors but not now
just nothing
begining to drive me nuts, especially as the msdn help is close to useless on using external DLLs and applying thier functions.
i'd use Ian's interface but i get errors all over the shop whenever i do ... my VC just doesn't like it. (not even the example compiled)
i'm sure one of you guys knows howto do this - i'm gonna grab an hr or so's kip as i'm cream cracked
this should've been simple