Hi,
I managed to build chatscript in Visual Studio 2010.
Next i defined the DLL tag in common.h:
#define DLL
Now, after building I get a chatscript.lib in adition to the chatscript.exe.
Now i wrote the following Program wich uses this .lib file:
#include "stdafx.h"
#include <iostream>
typedef FILE* (*UserFileCreate)(const char* name);
typedef FILE* (*UserFileOpen)(const char* name);
typedef int (*UserFileClose)(FILE*);
typedef size_t (*UserFileRead)(void* buffer,size_t size, size_t count, FILE* file);
typedef size_t (*UserFileWrite)(const void* buffer,size_t size, size_t count, FILE* file);
typedef size_t (*UserFileSize)(FILE* file);
typedef struct USERFILESYSTEM // how to access user topic data
{
UserFileCreate userCreate; // "wb" implied
UserFileOpen userOpen;
UserFileClose userClose;
UserFileRead userRead;
UserFileWrite userWrite;
UserFileSize userSize;
} USERFILESYSTEM;
extern "C" int InitSystem(int argc, char * argv[],char* unchangedPath = NULL,char* readonlyPath = NULL, char* writablePath = NULL, USERFILESYSTEM* userfiles = NULL);
int _tmain(int argc, _TCHAR* argv[])
{
int ret = InitSystem(0,NULL);
std::cout << "init:" << ret << std::endl;
system("pause");
return 0;
}
Now the weird part:
This new program chatScriptDummy.exe asks for the chatscript.exe. Afterwards it crashes.
If I open the chatscript.lib with the dependency walker it tells “No DOS or PE signature found. This is not a valid 32-bit or 64-bit windows module”.
I just scanned all documentation files and I only found the “ChatScript External Communications.pdf” helpful for my case. But it seems to be outdated, at least the InitSystem definition is not the same as in the sources. Also it doesn´t say anything about building a library. I also searched this forum and found a few threads talking about libraries, but nowhere i found a documentation how to do it.
Either I havent found one or it is so simple that you probably wouldn´t need one, because obviously peope managed to build a chatscript library.
Can you guys tell me where my mistake is?
Thank you,
Tobi