Definition of coderChannelCreate from AsyncIO for UDP Block Code Generation

6 views (last 30 days)
My Windows x64 installation of MATLAB has a file named asynciocoder_api.hpp in ./R2024b/extern/include/AsyncIO that declares various Channel functions on line 27, for example:
EXTERN_C ASYNCIOCODER_API CoderChannel coderChannelCreate(const char* const devicePlugin,
const char* const converterPlugin,
double const inputStreamLimit,
double const outputStreamLimit,
char* errorID,
char* errorText);
When I attempt to generate code for a simple UDP model (https://www.mathworks.com/help/releases/R2024b/instrument/udpsend.html), I get linker errors for these objects, for example:
simpleUDP_TxMdl.obj : error LNK2019: unresolved external symbol coderChannelCreate referenced in function "private: struct b_matlabshared_asyncio_internal_Channel_simpleU
DP_TxMdl_T * __cdecl simpleUDP_TxMdl::simpleUDP_TxMdl_Channel_Channel(struct b_matlabshared_asyncio_internal_Channel_simpleUDP_TxMdl_T *,char const * const,int const * co
nst,char const * const,int const * const,unsigned char,struct uint64m_T,struct uint64m_T,class coder::array<char,2> const &,unsigned short,unsigned char,class coder::arra
y<char,2> const &,unsigned char,unsigned char)" (?simpleUDP_TxMdl_Channel_Channel@simpleUDP_TxMdl@@AEAAPEAUb_matlabshared_asyncio_internal_Channel_simpleUDP_TxMdl_T@@PEAU
2@QEBDQEBH12EUuint64m_T@@3AEBV?$array@D$01@coder@@GE4EE@Z) [.\build\SimulinkUDP_Tx.vcxproj]
The EXTERN_C macro seems to be correctly creating C-style linkage without name mangling...but where are the definitions of these objects, or perhaps a library that I can link to resolve the linker errors?

Accepted Answer

Engenuity
Engenuity on 1 Apr 2025
Edited: Engenuity on 1 Apr 2025
The UDP blocks from the Instrument toolbox do not support code generation. Use the UDP blocks from the DSP toolbox instead (https://www.mathworks.com/help/releases/R2024b/dsp/ref/udpreceive.html).
I recommend enabling the 'PackageGeneratedCodeAndArtifacts' code generation setting (package will contain the required networkdevice.dll/so, DAHostLib_Network.h/c, and DAHostLib_rtw.h/c files).

More Answers (0)

Community Treasure Hunt

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

Start Hunting!