У меня очень простой заголовочный файл для библиотеки dll, но он находится на C++. Любой может помочь мне отредактировать его таким образом, чтобы он совместим с командой «LoadLibrary» в Matlab (native C)? Я понимаю, что это не общая проблема, а скорее отсутствие моих знаний. Но если решение будет простым, я буду признателен за любые советы.Matlab: заголовочный файл C++ для dll
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the TRACKERERRORSDLL_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// TRACKERERRORSDLL_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef TRACKERERRORSDLL_EXPORTS
#define TRACKERERRORSDLL_API __declspec(dllexport)
#define TRACKERERRORSDLL_VB __declspec(dllexport) __stdcall
#else
#define TRACKERERRORSDLL_API __declspec(dllimport)
#define TRACKERERRORSDLL_VB __declspec(dllimport) __stdcall
#endif
#include <string>
using namespace std;
bool TRACKERERRORSDLL_API GetTPIErrorDescription_wstring(long errorNumber,
basic_string<__wchar_t> & shortDescription,
basic_string<__wchar_t> & longDescription,
basic_string<__wchar_t> & solutionDescription,
bool & isAutoRecoverOnGreenState);
bool TRACKERERRORSDLL_API GetTPIErrorDescription_wstring(long errorNumber,
basic_string<unsigned short> & shortDescription,
basic_string<unsigned short> & longDescription,
basic_string<unsigned short> & solutionDescription,
bool & isAutoRecoverOnGreenState);
bool TRACKERERRORSDLL_API GetTPIErrorDescription_string(long errorNumber,
string & shortDescription,
string & longDescription,
string & solutionDescription,
bool & isAutoRecoverOnGreenState);
bool TRACKERERRORSDLL_API GetTPIErrorDescription_CString(long errorNumber,
CString & shortDescription,
CString & longDescription,
CString & solutionDescription,
bool & isAutoRecoverOnGreenState);
bool TRACKERERRORSDLL_VB GetTPIErrorDescription_VB(int errorNumber,
LPSTR* shortDescription,
LPSTR* longDescription,
LPSTR* solutionDescription,
bool* isAutoRecoverOnGreenState);
Ссылка для загрузки библиотеки (64bit): https://docs.google.com/file/d/0BzzppV2CG8ZldzFRVzJUa252MHc/edit?usp=sharing
Matlab R2013a 64bit
Вы нашли [эту тему] (https://www.mathworks.com/matlabcentral/newsreader/view_thread/154975) еще? –
вы также можете создать C++ MEX-функцию, которая ссылается на указанную выше библиотеку. Затем его легко использовать версию 'GetTPIErrorDescription_string', которая принимает' std :: string' и возвращает их в MATLAB как 'mxArray' – Amro