Visual Lisp:如何调用外部c++ DLL中的函数
Visual Lisp: how to call functions in external C++ DLL
我有一个我写的c++ dll(原生的,不是。net),我想从Visual Lisp中使用它的功能。谁能给我举个例子,告诉我如何做到这一点,或者至少应该阅读哪个文档?
我通过为我的dll编写activex/COM包装器来解决这个问题,我认为这应该使将来更容易链接到。在沼泽上启动一个线程,得到了一些关于如何从Visual Lisp调用COM的好朋友的回答。为了记录,它看起来像这样:
//in c++... (header and IDL file also needed)
hresult timestwo(double in,double* out)
{
*out = in*2;
return S_OK;
}
;; in Lisp...
(vl-load-com)
(setq myinstance (vlax-create-object "mycomwrapperdll.mycomwrapperclass"))
(setq num 12.34)
(vlax-invoke-method myinstance 'timestwo num 'newnum)
(vlax-release-object myinstance)
;; newnum now contains 24.68
使用acedDefun()和acedRegFunc() API调用将本地c++代码暴露给AutoLisp。
这是Autodesk编程论坛上的一个讨论,问的正是你的问题。
相关文章:
- 在函数内部的声明中初始化数组,并在外部使用它
- 使外部项目可用于find_package CMake
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- C++:来自外部文件的Trivia
- 从函数角度看ID到文件路径的内部与外部映射
- C++:将外部库链接到dll库
- spdlog标头仅与外部fmt一起使用.spdlog错误:'内部':不是'fmt'
- 节俭并发:未解决的外部问题
- 如何在c++中从git建立外部库
- 未解析的外部符号_MsiLocateComponentW@12.
- 如何使用对C函数和类对象的外部调用来处理C++头文件
- 具有外部"c"和程序集的未定义函数
- 为什么导入Mixed native/CLR lib.dll的本机C++应用程序没有在Mixed lib.dll中的外部变
- 在C++中使用 gRPC 时未解析的外部符号
- 在类函数中初始化外部作用域变量
- 如果全局变量默认是外部变量,为什么要添加"extern"关键字?
- 调用外部函数,无法指定类型 C++/MVS
- 同时具有"外部"和"内联"说明符的变量
- LibPrivoxy: 未解析的外部符号 __declspec(dllimport) int __stdcall Sta