共有ライブラリ shrlibsample
MATLAB® には、shrlibsample
というサンプルの外部ライブラリが含まれています。このライブラリは
フォルダーにあります。matlabroot
\extern\examples\shrlib
ソース コードを MATLAB で表示します。
edit([matlabroot '/extern/examples/shrlib/shrlibsample.c']) edit([matlabroot '/extern/examples/shrlib/shrlibsample.h'])
shrlibsample
ライブラリを使用するには、次のいずれかを選択します。
このフォルダーを MATLAB パスに追加します。
addpath(fullfile(matlabroot,'extern','examples','shrlib'))
このフォルダーを現在の作業フォルダーにします。
cd(fullfile(matlabroot,'extern','examples','shrlib'))
ライブラリを読み込んで、ライブラリにある関数の MATLAB シグネチャを表示します。
loadlibrary('shrlibsample') libfunctions shrlibsample -full
Functions in library shrlibsample: [double, doublePtr] addDoubleRef(double, doublePtr, double) double addMixedTypes(int16, int32, double) [double, c_structPtr] addStructByRef(c_structPtr) double addStructFields(c_struct) c_structPtrPtr allocateStruct(c_structPtrPtr) voidPtr deallocateStruct(voidPtr) lib.pointer exportedDoubleValue lib.pointer getListOfStrings doublePtr multDoubleArray(doublePtr, int32) [lib.pointer, doublePtr] multDoubleRef(doublePtr) int16Ptr multiplyShort(int16Ptr, int32) doublePtr print2darray(doublePtr, int32) printExportedDoubleValue cstring readEnum(Enum1) [cstring, cstring] stringToUpper(cstring)