I'm trying to create a closed source dll that has access to the engine calls in scripts.dll.
The GNU doesn't say anything about calling custom code with a function pointer, But then, it doesn't say much else either.
So, here's what i did:
Scripts.dll
//.h
#include <string>
using namespace std;
typedef void (*CI)(string);
typedef void (*CO)(string);
void Con_In(string Str);
void Con_Out(string Str);
//.cpp
#include "scripts.h"
#include "engine.h"
void Con_In(string Str)
{
Console_Input(Str.c_str());
}
void Con_Out(string Str)
{
Console_Output("%s", Str.c_str());
}
MyDLl
#include <string>
using namespace std;
typedef void (*CI)(string);
typedef void (*CO)(string);
CI Console_Input;
CO Console_Output;
extern "C"
{
__declspec(dllexport) void InitCustomCommands(CI ConIn, CO ConOut)
{
Console_Output = ConOut;
Console_Input = ConIn;
Console_Output("myDll Loaded.\n");
}
}