S function Impossible to Load library

Hi All,
i have this problem when i tried to run a simulation with simulink,
Error reported by S-function 'mp_read_fields' in 'matlab_dll_read/Fields Reader/Read Fields': Impossible to load library
Is there any clue to what could possible causing this error?
Thank you

回答(2 个)

What do you get when you run these commands at your MATLAB prompt:
>> which mp_read_fields
Do you have access to the source code for this file? The error "Impossible to load library" doesn't seem like a standard error that Simulink or the OS would throw. My guess is that the file 'mp_read_fields' itself is reporting this error. Perhaps there some DLL dependencies that it cannot find on your machine?
Have you been able to get this S-function to work on any other machine?

3 个评论

I also suspect this is not a standard Simulink error: I did a web search for the error text you provided and Simulink, and came up with nothing.
Hi All,
Thank you for replying. i traced through and it has got to do with loading my own dll. the function is not able to load my dll.
pushing my luck here, it tells me error 126, mod not found. but i can use this dll with other software no problem. clue? i am sure its not path because i hard coded the path and it is giving me the same error code.
Thank you Asadilan
That kind of error typically implies missing module dependencies. Perhaps you should try profiling your DLL with Dependency Walker to see if it can't find certain DLLs. Also, is the DLL for the same platform (32-bit vs. 64-bit) as the S-function DLL? You can figure this out using DUMPBIN.

请先登录,再进行评论。

Image Analyst
Image Analyst 2012-8-13
You probably didn't pass in the full path (folder + base filename) of the DLL or the filename was somehow otherwise not correct. You should always use exist(fullFileName, 'file') before calling LoadLibrary() to make sure the file exists, and alert the user if the file can't be found. For example, is 'matlab_dll_read/Fields Reader/Read Fields' the file name? Shouldn't it have a .DLL extension and a drive letter?

4 个评论

ah i c. would you be able to tell me how i can specify the drive and folder?
'matlab_dll_read/Fields Reader/Read Fields' looks to me as if it is a Simulink block name.
It would be useful to know which library could not be loaded, and whether the attempt is being made in user code or in Simulink code that is expected to be transparent to the user.
If Walter is right, I can't help you since I just use the LoadLibrary() function in regular MATLAB and I don't have Simulink. But tell him what library you were trying to load.
Hi all,
i am trying to load my own dll. i think the file exists as i can use the dll with a different dll, but when trying to load with matlab, it gives me an error 126 (hard coded path).
Any clue?
Thank you, Asadilan

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Simulink Environment Customization 的更多信息

产品

提问:

2012-8-13

Community Treasure Hunt

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

Start Hunting!

Translated by