- 'your_structure_type' is the appropriate structure type defined in the DLL
- 'your_dll_function' with the name of the DLL function you want to call.
- your_dll_file.dll" is the actual name of your DLL file.
matlab与c/c++混编如何生成指向外部常量结构体的指针?
조회 수: 1 (최근 30일)
이전 댓글 표시
最近在用matlab调用相机,相机有二次开发包里面有封装好的c语言编写的dll文件,但是里面的函数需要指向相机信息结构体的指针作为输入,我感觉并不是传递参数,而是传递一个地址,这个matlab可以实现吗,希望大家赐教![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1425308/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1425308/image.png)
댓글 수: 0
답변 (1개)
Ayush
2023년 8월 14일
我将用英语回答您的询问
You can pass the pointer to camera information structure as an input to the function as shown in the code below:
% Create a pointer to the camera information structure
cameraInfoPtr = libpointer('your_structure_type', yourCameraInfo);
% Call the DLL function with the pointer
calllib('your_dll_file.dll', 'your_dll_function', cameraInfoPtr);
where,
Also, ensure that the DLL file is located in the MATLAB search path or specify the full file path if it is located elsewhere.
You may refer to the documentation here: Pointer object for use with shared C library - MATLAB libpointer - MathWorks India
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!