1. 程式人生 > >在C++代碼中調用L腳本語言

在C++代碼中調用L腳本語言

str tengine track 引擎 -m post easy rip file

L腳本語言同意被其他編程語言調用。如C++,非常easy。僅僅要在宿主語言中載入L腳本引擎的動態庫

直接調用這兩個函數就能夠了

extern "C" int __stdcall ScriptEngineDoString(wchar_t * ScriptString);
extern "C" int __stdcall ScriptEngineDoScriptFile(wchar_t * ScriptFileName);


C語言調用L腳本引擎的樣例:


#include <windows.h>
#include "../ScriptEngineDll/ScriptEngineDll.h"


int _tmain(int argc, _TCHAR* argv[])
{
HMODULE hDLL = LoadLibraryW(L"ScriptEngineDll.dll");
if(hDLL)
{
FUNC_ScriptEngineDoString ScriptEngineDoString =(FUNC_ScriptEngineDoString)GetProcAddress(hDLL,"ScriptEngineDoString");
if(ScriptEngineDoString)
{
ScriptEngineDoString(L"重新啟動:計算機");
}
}
return 0;
}

在C++代碼中調用L腳本語言