ZScript FileExecute 到 DLL
ZScript FileExecute to DLL
在 ZBrush 的 ZScript 中,您可以使用 FileExecute
调用 DLL
[FileExecute,"ZBRUSH_ZData\ZPlugs\WebZPlug.dll",HTTP_Browse,"http://www.zbrushcentral.com"]
从 ZScript 接收参数和数据的 DLL 入口点(C/C++ 函数)签名是什么?在 ZScript 和 C++ 之间是否有任何未记录的参数来编组数据结构?
恢复一些部分回答这个问题的文档后:这是完整的 FileExecute
签名:
[FileExecute, Filename, Function to call, Optional text input, Option numeric input, Optional memory block input, Optional memory block output]
您可以传递在 ZScript 中创建的内存块 "MemBlock":
[FileExecute, "DllName.dll", "FunctionName", "StringArgument", [MemGetSize, "MemBlock"], "MemBlock",]
这里是 DLL 中的一个 C++ 函数,用于接收来自 ZScript 的调用,以及内存块:
#define DLLEXPORT __declspec(dllexport)
extern "C" int DLLEXPORT FunctionName(unsigned char* message, double number, void* memblock, void* memblock2)
{
int mbSize = (int)number; // the second argument has to be a double
// Read from the memory block via a strstream
stdstrstream mbStream((char*)memblock, mbSize);
// Read the first integer written into the memory block by the ZScript
int val = 0;
mbStream.read((char*)&val, 4);
}
extern "C"
是让一个 C++ 函数有一个 'C' linkage(编译器不会破坏名字)这样 ZBrush C 代码就可以 link 它.
在 ZBrush 的 ZScript 中,您可以使用 FileExecute
[FileExecute,"ZBRUSH_ZData\ZPlugs\WebZPlug.dll",HTTP_Browse,"http://www.zbrushcentral.com"]
从 ZScript 接收参数和数据的 DLL 入口点(C/C++ 函数)签名是什么?在 ZScript 和 C++ 之间是否有任何未记录的参数来编组数据结构?
恢复一些部分回答这个问题的文档后:这是完整的 FileExecute
签名:
[FileExecute, Filename, Function to call, Optional text input, Option numeric input, Optional memory block input, Optional memory block output]
您可以传递在 ZScript 中创建的内存块 "MemBlock":
[FileExecute, "DllName.dll", "FunctionName", "StringArgument", [MemGetSize, "MemBlock"], "MemBlock",]
这里是 DLL 中的一个 C++ 函数,用于接收来自 ZScript 的调用,以及内存块:
#define DLLEXPORT __declspec(dllexport)
extern "C" int DLLEXPORT FunctionName(unsigned char* message, double number, void* memblock, void* memblock2)
{
int mbSize = (int)number; // the second argument has to be a double
// Read from the memory block via a strstream
stdstrstream mbStream((char*)memblock, mbSize);
// Read the first integer written into the memory block by the ZScript
int val = 0;
mbStream.read((char*)&val, 4);
}
extern "C"
是让一个 C++ 函数有一个 'C' linkage(编译器不会破坏名字)这样 ZBrush C 代码就可以 link 它.