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

Respuestas (2)

Kaustubha Govind
Kaustubha Govind el 14 de Ag. de 2012
Editada: Kaustubha Govind el 14 de Ag. de 2012
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 comentarios

K E
K E el 14 de Ag. de 2012
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.
asadilan
asadilan el 14 de Ag. de 2012
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
Kaustubha Govind
Kaustubha Govind el 15 de Ag. de 2012
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.

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 13 de Ag. de 2012

0 votos

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 comentarios

asadilan
asadilan el 13 de Ag. de 2012
ah i c. would you be able to tell me how i can specify the drive and folder?
Walter Roberson
Walter Roberson el 13 de Ag. de 2012
'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.
Image Analyst
Image Analyst el 13 de Ag. de 2012
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.
asadilan
asadilan el 14 de Ag. de 2012
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

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Environment Customization en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 13 de Ag. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by