AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Building a DLL
 
 

I’ve been working on building Chatscript as a DLL, which I’ve done now, but for information and future reference, I had to make a small change to the code.

When the DLL is loaded via a LoadLibrary() call, then the location of the code might be relocated in the processes’ address space. This was certainly true for me in the environment I was running in. What this meant was that the userFileSystem struct that contains pointers to the various file handling functions was now pointing to the wrong locations and the app crashed as soon as I tried to PerformChat().

My solution was to reinitialise the userFileSystem struct in InitSystem() to the same functions.

unsigned int InitSystem(int argccharargv[]charunchangedPathcharreadablePathcharwriteablePathUSERFILESYSTEMuserfiles)
{
 InitFileSystem(unchangedPath
readablePathwriteablePath);
#ifdef DLL
 
userFileSystem { FopenBinaryWriteFopenReadWrittenfclosefreadfwriteFileSize };
#endif
 
. . .

 

 

 
  [ # 1 ]

Duly noted. I will revise for next release (though wont require Ifdef DLL).

 

 
  login or register to react