I want to create a dll with VC++ 2008 Express and then use it in autoit scripts but I encounter some troubles.
Dll Code
#include <stdio.h> #include <stdlib.h> extern "C" __declspec(dllexport) size_t FileOpen(char *filename) { FILE * pFile; long lSize; char * buffer; size_t result; pFile=fopen(filename,"rb"); fseek(pFile,0,SEEK_END); lSize=ftell(pFile); rewind(pFile); buffer = (char*) malloc (sizeof(char)*lSize); result = fread (buffer,1,lSize,pFile); fclose (pFile); free (buffer); return result; }
When I compile this dll I got one warning but no errors. If I try to use this function from AutoIt script will crash.
#include <Array.au3> $DLL = DllOpen("File.dll") $RESULT = DllCall($DLL,"int:cdecl","FileOpen","str","Test1.dat") DllClose($DLL) _ArrayDisplay($RESULT)
Anyone know what I make wrong?
Edited by Andreik, 16 May 2011 - 05:35 PM.




