Loading a .dll written in c++

5 visualizzazioni (ultimi 30 giorni)
Philipp Mandl
Philipp Mandl il 1 Giu 2020
Hi,
I have written a .dll in Visual Studio in c++ and wrapped in extern C-functions. Now I tried to load the .dll with the header files in matlab
addpath('D:\Philipp\repos\uwp_force_feedback\FF_UWP_dll\FF_dll\FF_dll')
if not(libisloaded('FF_dll.dll'))
loadlibrary('D:\Philipp\repos\uwp_force_feedback\FF_UWP_dll\FF_dll\x64\Release\FF_dll\FF_dll.dll', 'D:\Philipp\repos\uwp_force_feedback\FF_UWP_dll\FF_dll\FF_dll\FF_dll.h')
end
and get the following errors:
Error using loadlibrary
There was an error loading the library "D:\Philipp\repos\uwp_force_feedback\FF_UWP_dll\FF_dll\x64\Release\FF_dll\FF_dll.dll"
Das angegebene Modul wurde nicht gefunden. (EN: The specified module was not found.)
Error in test (line 4)
loadlibrary('D:\Philipp\repos\uwp_force_feedback\FF_UWP_dll\FF_dll\x64\Release\FF_dll\FF_dll.dll', 'D:\Philipp\repos\uwp_force_feedback\FF_UWP_dll\FF_dll\FF_dll\FF_dll.h')
Caused by:
Error using loaddefinedlibrary
Das angegebene Modul wurde nicht gefunden. (EN: The specified module was not found.)
For reference here is my header file:
#pragma once
#ifdef FF_UWP_EXPORTS
#define FF_UWP_API __declspec(dllexport)
#else
#define FF_UWP_API __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
typedef struct wheelreadings {
double throttle;
double brake;
double clutch;
double angle;
double mastergain;
} WheelReadings;
// Initialize the racing wheel
FF_UWP_API void initRacingWheel();
FF_UWP_API int initForceFeedback(int samplingTime);
FF_UWP_API void readWheelStatus(WheelReadings* wheelValues);
FF_UWP_API void FF_minus(double gain);
}
#else
typedef struct wheelreadings {
double throttle;
double brake;
double clutch;
double angle;
double mastergain;
} WheelReadings;
// Initialize the racing wheel
FF_UWP_API void initRacingWheel();
FF_UWP_API int initForceFeedback(int samplingTime);
FF_UWP_API void readWheelStatus(WheelReadings* wheelValues);
FF_UWP_API void FF_minus(double gain);
#endif
Any ideas why it won't load?

Risposte (0)

Tag

Prodotti


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by