Running generated C-code returns error "Could not open library: libmwhostlibaudio.dylib"

조회 수: 7 (최근 30일)
Hello, I'm trying to run an executable I created from a Simulink model that processes real-time sound inputs. However, I get the error message
Could not open library: libmwhostlibaudio.dylibCould not open library: libmwhostlibaudio.dylib
When I directly look at the executable in XCode, libmwhostlibaudio.dylib appears when the code has to create an Audio Device Reader and Audio Device Writer (underlined emphasis my own):
/* Start for S-Function (saudioFromAudioDevice): '<Root>/Audio Device Reader' */
sErr = GetErrorBuffer
(&Simulink_model.AudioDeviceReader_AudioDeviceLib[0U]);
CreateHostLibrary("libmwhostlibaudio.dylib",
&Simulink_model.AudioDeviceReader_AudioDeviceLib[0U]);
...
/* Start for S-Function (saudioToAudioDevice): '<Root>/Audio Device Writer' */
sErr = GetErrorBuffer
(&Simulink_model.AudioDeviceWriter_AudioDeviceLib[0U]);
CreateHostLibrary("libmwhostlibaudio.dylib",
&Simulink_model.AudioDeviceWriter_AudioDeviceLib[0U]);
Within my machine, libmwhostlibaudio.dylib only appears within the C-code and not as its own file. Do I have to generate this file myself, or is the solution to this problem something else entirely?

채택된 답변

jibrahim
jibrahim 2023년 1월 20일
Hi Jio,
The audio device blocks have a dependency on a dll that ships with MATLAB. If you want to execute your generated code, you will have to make sure that DLL is packaged correctly. You do not have to generate it yourself. Typically this is done using packngo. This link might be helpful to you:
  댓글 수: 2
Jio Nocon
Jio Nocon 2023년 1월 23일
편집: Jio Nocon 2023년 1월 23일
Hi, I re-generated the model using those instructions. I was able to find the DLL files under the ZIP file, but I still run into that same error when I run the executable on Terminal. Should I need to use another development environment to run the code, or do I have to define something in Terminal before running the executable?
Jio Nocon
Jio Nocon 2023년 1월 24일
Update: I was able to get the model working on a machine that runs Windows with the packNGo utility and help from this answer: https://www.mathworks.com/matlabcentral/answers/457938-why-do-i-get-the-error-could-not-open-library-networkdevice-dll-when-running-a-generated-executab. I didn't realize that the DLLs had to be in the same folder as executable.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by