warnings returned by loadlibrary
6 ビュー (過去 30 日間)
古いコメントを表示
I'm starting to learn MatLab, and as an exercise I'm using loadlibrary to call a function in a windows dll file. I've defined the header file according to the example in the help documentation, and called loadlibrary to load the external library. When I do I get multiple warnings about data types that do not exist. Some of the warnings say a data type used by a structure does not exist and some of the warnings say a data type used by a function does not exist.
How can I eliminate these warnings?
Here's the code snippet:
hfile = [matlabroot '\sys\lcc\include\mmsystem.h'];
loadlibrary ('winmm', hfile );
%define some variables
returnString = [];
returnStringLength = 0;
calllib ( 'winmm', 'mciSendStringA', 'set cdaudio door open', returnString, returnStringLength, 0);
Pause;
calllib ( 'winmm', 'mciSendStringA', 'set cdaudio door closed', returnString, returnStringLength, 0);
unloadlibrary winmm
As I said, it's just a really simple experiment in calling an external api. It opens the CD tray, waitss for me to press a key, then closes the tray. The code works, but I'd like to figure out the cause (and correct if I can) of the warnings.
...and now here's the warnings:
Warning: Warnings messages were produced while parsing. Check the functions you intend to use for correctness. Warning text can be viewed using: [notfound,warnings]=loadlibrary(...)
> In loadlibrary at 396
In CDTray at 12
Warning: The data type 's_wavehdrPtr' used by structure s_wavehdr does not exist. The structure may not be usable.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 's_midihdrPtr' used by structure s_midihdr does not exist. The structure may not be usable.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'FcnPtrPtr' used by structure s_MMIOINFO does not exist. The structure may not be usable.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'FcnPtrPtr' used by function mmioInstallIOProcA does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'FcnPtrPtr' used by function mmioInstallIOProcW does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'FcnPtr' used by function mciSetYieldProc does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'FcnPtr' used by function mciGetYieldProc does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function waveOutGetPosition does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function waveInGetPosition does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function mixerGetLineControlsA does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function mixerGetLineControlsW does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function mixerGetControlDetailsA does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function mixerGetControlDetailsW does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function timeGetSystemTime does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'FcnPtrPtr' used by function timeSetEvent does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function midiStreamPosition does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function mixerGetLineInfoA does not exist.
> In loadlibrary at 458
In CDTray at 12
Warning: The data type 'error' used by function mixerGetLineInfoW does not exist.
> In loadlibrary at 458
In CDTray at 12
回答 (2 件)
Philip Borghesani
2011 年 1 月 26 日
The warnings can not be prevented when using a header that depends on windows.h but they can be suppressed by using:
warning off MATLAB:loadlibrary:TypeNotFound
warning off MATLAB:loadlibrary:TypeNotFoundForStructure
[notfound,warnings]=loadlibrary(libname,header,...);
See help for the function WARNING for more information of properly saving and restoring the warning state if desired.
For production code it is better to create a loader MATLAB file using the mfilename option to loadlibrary and edit that to remove unneeded functions and structures and to fix any errors in it. Loading a library is much faster when a loader file is used instead of a header.
0 件のコメント
Patrick
2011 年 3 月 24 日
What do you mean with "can not be prevented when using a windows header"?
I use the mfilename option and also get warnings, that some data types not exists. Because of this I can not use some funtions of this library.
The same library compiled for linux works fine (with a linux system).
Thanks.
1 件のコメント
Philip Borghesani
2011 年 3 月 24 日
Please post a new question for help with your problem.
To clarify for the purpose of this posting a windows header is one that depends on windows.h which defines many function and structures that can not be handled by loadlibrary.
参考
カテゴリ
Help Center および File Exchange で Musical Instrument Digital Interface (MIDI) についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!