How to call .dll document in RTW

I am using the Real time workshop(RTW) to create .exe software.I have chose "rtwin.tlc" as my "System target file", "rtwintmf" as my "Template makefile", "make_rtw" as my "Make command".
In my .mdl document,I have used a S-function block in which it used some Windows API function。When the "build" button was pressed
down,there were some errors reported in the Matlab comment window as follows:
Could Anybody tell me how to solve this problom?
-export:GetBoards
Creating library ..\RTW_send.lib and object ..\RTW_send.exp
rtwsend.obj : error LNK2001: unresolved external symbol __imp__htons@4
rtwsend.obj : error LNK2001: unresolved external symbol __imp__inet_addr@4
rtwsend.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
rtwsend.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
rtwsend.obj : error LNK2001: unresolved external symbol __imp__socket@12
rtwsend.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
rtwsend.obj : error LNK2001: unresolved external symbol __imp__Sleep@4
rtwsend.obj : error LNK2001: unresolved external symbol __imp__sendto@24
rtwsend.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
..\RTW_send.rwd : fatal error LNK1120: 9 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.

Answers (1)

Kaustubha Govind
Kaustubha Govind on 27 Jun 2011
According to this page in the Real-Time Windows Target (RTWT) documentation, Win32 API calls are not allowed in custom drivers blocks written for RTWT.
Regardless, to fix the linker error, you may just need to add the paths to the corresponding libraries to the model's Custom Code pane in the Real-Time Windows (or Code Generation) tab of the Configuration Parameters window.

Categories

Find more on Debugging and Improving Code in Help Center and File Exchange

Asked:

ma
on 25 Jun 2011

Community Treasure Hunt

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

Start Hunting!