| How to call DLL functions? |
The script engine call import procedure and functions from external DLL files. Thus, you can extend your publication by calling your own DLL functions. Moreover, DLL can be stored into the publication EXE file for easier deployment. How to import a DLL function in HEScript?This is done thanks to the external keyword. Syntax: procedure/function Name(parameters...): optional type; external "functionname@dllname calling convention"; Take a look at these examples: // Win32 API used to determine an environment variable. const How to store a DLL file and call it at runtime?If your DLL file must be deployed with the publication EXE file, you can add it to the File Manager in the root folder of your publication. Thus, it will be compiled with your EXE file. Then, you need to tell the runtime module that the DLL file is actually inside the publication thanks to the HETEMP_ prefix. See this example: We have a simple DLL named MyOwnDll.dll. It exports a ShowMsg procedure that will display a message box. We added MyOwnDll.dll file to the file list. It appears in the Publication root:
Then we added these lines to the owndll script: // owndll And finally, we call owndll.TestDLL from this HTML page. Just click the following link to try the code: Note that the DLL is temporarily unpacked before its functions are called, and deleted when the publication closes. |