Undefined function or variable 'fid' , but 'fid' isn't in any of the script files
古いコメントを表示
Have created a Matlab generated DLL that is called from a Visual Studio 2010 C++ application. There are 4 M files (written by an ex co-worker 10 years ago) that are compiled for the DLL ; there is no variable or function named 'fid' in any of them. At run time, I catch a mwException after the call to the DLL, and the exception.what() shows "Undefined function or variable 'fid' ".
I'm sorry that I can't show the M files (it's proprietary code in a competitive market) but 'fid' is not in any of them, or even in the C++ application itself.
Not much to go on, I'm afraid - I was just hoping that somebody might have a suggestion for someone new to Matlab. Thanks.
回答 (2 件)
C.J. Harris
2011 年 8 月 16 日
1 投票
The variable 'fid' is usually associated with file reading. You might want to start your search at those points in the code where you either open or close an external file (such as a txt/dat file).
Walter Roberson
2011 年 8 月 16 日
1 投票
Possibly "fid" is being constructed as a variable name and used in an eval() or feval() statement.
If .fig files are involved somewhere, the reference to "fid" could be buried in some property of a graphic, such as a callback.
The error message you see would be consistent with the possibility that some routine with a parameter named "fig" is being passed too few arguments.
Does diary() work in DLL's, I wonder?
6 件のコメント
Bill
2011 年 8 月 16 日
Walter Roberson
2011 年 8 月 16 日
If you are not using a .fig file via openfig() or load(), and if you do not use the relatively new refreshdata() call, then graphics is _probably_ not the problem (but I would not rule it out.)
In the parts you happen to show, there is nothing that would trigger the graphics related possibilities I described earlier. Especially as it is effectively commented out via the "if 0".
Bill
2011 年 8 月 17 日
Bill
2011 年 8 月 17 日
Walter Roberson
2011 年 8 月 17 日
Whether or not the compiler generated code for the "if 0" section, it would never _execute_ that code, so nothing in that code could have an effect.
I think what I would suggest at this point is to use the dependency analysis tool, and read through the results carefully looking for calls to routines you do not expect to be called, such as calls to something in a local library where you are expecting the MATLAB library to be called instead.
Bill
2011 年 8 月 18 日
カテゴリ
ヘルプ センター および File Exchange で C Shared Library Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!