NSIS插件功能无法识别
NSIS Plugin Function not recognised
我制作了一个非常简单的NSIS插件,其中有一个函数。我已经成功地将Win32 DLL项目编译成DLL,然后将其复制到目录C:\Program Files(x86)\NSIS\Plugins
我的问题:当我创建从dll调用函数的.nsi脚本时,我收到一个编译错误,说无效命令:tbox::myFunction
我做错了什么我需要将tbox.lib文件也复制到NSIS目录中,还是创建一个tbox.nsh文件来包含
我的dll的名称是tbox.dll,我的nsi脚本在下面,下面是我的C++dll代码:
!include MUI2.nsh
!include WinMessages.nsh
Name "aa.nsi"
OutFile "aa.exe"
Caption "${^Name}"
ShowInstDetails show
!define MUI_CUSTOMFUNCTION_GUIINIT MyGUIInit
Section "Dummy"
MessageBox MB_ICONINFORMATION|MB_OKCANCEL "dvkjdkj"
tbox::myFunction "abc" "def"
SectionEnd
DLL代码:
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#pragma comment(lib, "msimg32.lib")
#include <commctrl.h>
#include "TransparentCheckbox.h"
#include "NSIS/pluginapi.h"
HINSTANCE g_hInstance;
HWND g_hwndParent;
unsigned int g_stringsize;
stack_t **g_stacktop;
TCHAR *g_variables;
// To work with Unicode version of NSIS, please use TCHAR-type functions for accessing the variables and the stack.
HWND __declspec(dllexport) myFunction(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
{
TCHAR buf[1024];
wsprintf(buf,TEXT("string_size=%d, variables=%sn"), string_size, variables);
MessageBox(g_hwndParent,buf,0,MB_OK);
}
return g_hwndParent;
}
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
g_hInstance = (HINSTANCE)hInst;
return TRUE;
}
编译时Makensis列出了所有插件及其导出的函数。
如果你的插件没有列出,那么它不在正确的目录中,或者根本没有导出。如果它已列出,但名称(tbox::_myFunction
或tbox::myFunction@xyz
)错误,则说明存在装饰问题。您可以尝试extern "C" HWND __declspec(dllexport) __cdecl myFunction(...
,如果这还不够,您可能需要一个.def文件。
您还可以使用Dependency Walker查看导出。。。
如果您想在当前脚本目录中加载插件,请使用以下命令:
!addplugindir "."
相关文章:
- 在执行其他功能的同时播放动画(LED矩阵和Arduino/ESP8266)
- 多态性和功能结合
- 提升 ASIO 无法识别计时器对象
- 从udp接收帧对于人脸识别来说太慢
- 带内存和隔离功能的SQLite
- 模板类无法识别友元运算符
- 在CMakeLists.txt的安装功能中使用.cmake文件有什么用
- 无法识别模板功能
- 为什么Visual Studio无法识别is_open()功能
- 为什么C 模板功能无法在同一标头文件中识别功能
- PEG规则以识别功能原型
- 如何求解与GCC/Clang不同的C 功能模板的MSVC处理(无法识别的模板定义)
- 为什么主函数不识别其他功能是否返回float类型编号
- 使用C++中的设备IO控制功能识别系统保留驱动器
- NSIS插件功能无法识别
- 模板功能,用于从其他容器中识别smart_pointer
- opencv/ c++:将保存的图像放置在具有面部识别功能的网络摄像头流上
- 调试断言失败!在人脸识别打开Cv的检测和显示功能中
- 使用Mat,并识别imread功能
- Eclipse C.D.T. 无法识别标准功能或"NULL"