Game Development Community

Extending ConsoleMethod to be able to return U64 [solved]

by Justin Mosiman · in Torque Game Builder · 12/26/2009 (3:47 am) · 0 replies

Edit: I had to do more digging in the console class and namespace, but it looks like I can return U64 now

Hello,

I want to return a U64 variable type from the engine to script using a console method, but I am getting a link error:
Quote:
1>dataManager.obj : error LNK2019: unresolved external symbol "public: __thiscall ConsoleConstructor::ConsoleConstructor(char const *,char const *,unsigned int (__cdecl*)(class SimObject *,int,char const * * const),char const *,int,int,bool)" (??0ConsoleConstructor@@QAE@PBD0P6AIPAVSimObject@@HQAPBD@Z0HH_N@Z) referenced in function "void __cdecl `dynamic initializer for 'DataManagergetFinalScoreobj''(void)" (??__EDataManagergetFinalScoreobj@@YAXXZ)
1>dataManager.obj : error LNK2019: unresolved external symbol "unsigned __int64 __cdecl dAtoull(char const *)" (?dAtoull@@YA_KPBD@Z) referenced in function "unsigned int __cdecl cDataManagergetFinalScore(class DataManager *,int,char const * *)" (?cDataManagergetFinalScore@@YAIPAVDataManager@@HPAPBD@Z)

Originally I was getting a compile error, but then I added the following to console.h:

// Line 135
typedef U64            (*ULLCallback)(SimObject *obj, S32 argc, const char *argv[]);

// Line 723
ConsoleConstructor(const char *className, const char *funcName, ULLCallback ullfunc, const char* usage,  S32 minArgs, S32 maxArgs, bool toolOnly = false);

// Line 760
#define conmethod_return_U64                return (U64

I was just following the format of the other variable types, I don't really know what I am doing this deep in the code. Also one of the parameters within the consolemethod is of type U64, which may explain some of the link errors. I converted the string to U64 with a new function dAtoull. Anybody have any ideas?

Thanks,
Justin