I've been searching for hours and I can't find what I'm looking for.
I'm learning how to make plugins, and up to now it was going pretty good.
However the trouble comes when trying to access DBP functions from within DBP. The weird part is, I can access 'Core' functions fine; I just can't access anything else. (2D, 3D, etc.)
The following works fine:
#define EXPORT __declspec ( dllexport )
#include "windows.h"
#include "stdio.h"
#include "globstruct.h"
GlobStruct *g_pGlob;
EXPORT void ReceiveCoreDataPtr( void *cdp )
{
g_pGlob = (GlobStruct *) cdp;
}
extern "C"
{
EXPORT void _DoStuff( )
{
HMODULE CoreLib = LoadLibrary( TEXT( "DBProCore.dll" ) );
typedef void ( __cdecl *tPrint )( int );
tPrint Print = ( tPrint ) GetProcAddress( CoreLib, "?PrintInteger@@YAX_J_N@Z" );
Print( 100 );
}
}
However this code crashes when I run a DBP project and use the function:
#define EXPORT __declspec ( dllexport )
#include "windows.h"
#include "stdio.h"
#include "globstruct.h"
GlobStruct *g_pGlob;
EXPORT void ReceiveCoreDataPtr( void *cdp )
{
g_pGlob = (GlobStruct *) cdp;
}
extern "C"
{
EXPORT void _DoStuff( )
{
typedef void ( __cdecl *tCircle )( int, int, int );
tCircle Circle = ( tCircle ) GetProcAddress( g_pGlob->g_Basic2D, "?Circle@@YAXHHH@Z" );
Circle( 100, 100, 100 );
}
}
So could someone offer me some functional code on accessing DBP functions from a DLL so that I can get a clue on what to do? This is realllllly bugging me.
EDIT:
Oops. Typo in title.
EDIT 2:
ahh, nevermind. I got it working. Apparently I have to use a command from the same DLL that my function is from in the same program. For instance, this works:
Dot 50, 50
Draw Circle 50, 50, 50
but this doesn't