フィルターのクリア

how to add static link library to S function

7 ビュー (過去 30 日間)
Stefan Jakubjak
Stefan Jakubjak 2021 年 12 月 7 日
コメント済み: Yavuzhan Erdem 2023 年 12 月 2 日
I am creating block scheme i want to use hil sdk functions to controll qube servo 2 from for linux (ubuntu 20.4.)
These functions should be only c functions.
I created S function but i can't link .a static link library and .h how can it be done ?
  1 件のコメント
Yavuzhan Erdem
Yavuzhan Erdem 2023 年 12 月 2 日
Hello Dear,
Have you solved the problem ? I have also same problem. Actualll, I can compile s-function and get output file with .mexwa extension. However , when I run the simulink mod el , Undefined symbol error occured.

サインインしてコメントする。

回答 (1 件)

Mark McBroom
Mark McBroom 2021 年 12 月 20 日
When compiling and linking your s-function using the mex command, you can provide optional argument -L to link to a library.
You can also use the legacy_code tool or the C Caller Block to define your s-function and specify the names and locations of libraries that are to be linked with your s-function.
  1 件のコメント
Stefan Jakubjak
Stefan Jakubjak 2022 年 1 月 2 日
編集済み: Stefan Jakubjak 2022 年 1 月 2 日
Thank you for your answer but , i don't really understand how it should it work I have c file with code which i want to get to matlab. I have this in makefile:
CFLAGS += -I/opt/quanser/hil_sdk/include
LDFLAGS += -L/opt/quanser/hil_sdk/lib
LIBS += -lhil -lquanser_runtime -lquanser_common -lrt -lpthread -ldl -lm -lc
myhilapp: myhilapp.o
cc $(LDFLAGS) $< -o $@ $(LIBS)
myhilapp.o: myhilapp.c
When i write make in terminal it generates file from .c file and i can run it using ./
How can i convert this makefile to matlab and make it work altogether ?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by