Game Development Community

Include dll

by Riccardo Berta · in Torque Game Engine · 05/23/2007 (4:40 am) · 1 replies

I'm trying to include in Torque a dll that is built in C#.
I have defined a __gc class (required for manged code I think), but it doesn't work: I have problems exposing this class to the scripting.
This is the error VisualStudio returns:
Torque Demo error LNK2020: unresolved token (06004778) NewcBot::DECLARE_CONOBJECT

This is my code:

#include

#using
#using
#using

using namespace AIMLBot;
using namespace System;
using namespace System::Collections;

__gc class NewcBot
{
private:
String *sRawInput, *sUserID, *sInput, *sThat, *sTopic, *sBotID, *sFile;
bool isDebug;
String * sAIMLPath;
ArrayList *alOutput;
cBot* m_pC;


public:
DECLARE_CONOBJECT( NewcBot* );

// constructor
NewcBot(String* sAIMLPath, bool isDebug) { m_pC = new cBot(sAIMLPath, isDebug); }
// destructor
~NewcBot() { }

// method
String* newchat(String* sRawInput, String* sUserID, String* sInput, String* sThat, String* sTopic,
String* sBotID, ArrayList *alOutput, String* sFile)
{
cResponse *risposta = new cResponse (sInput, sThat, sTopic, sUserID, sBotID, alOutput, sFile);
risposta = m_pC->chat(sRawInput, sUserID);
return risposta->getOutput();
}
};


//-----------------------------------------------------------------------------


IMPLEMENT_CONOBJECT( NewcBot* );

#1
05/29/2007 (6:51 am)
I could be wrong, but I don't think you want to make the object a pointer:

Replace:
DECLARE_CONOBJECT( NewcBot* );
IMPLEMENT_CONOBJECT( NewcBot* );

With:
DECLARE_CONOBJECT( NewcBot);
IMPLEMENT_CONOBJECT( NewcBot);