IBM Support

Exporting a model containing sub-Blocks with ActivityDiagrams to Simulink causes linker errors

Troubleshooting


Problem

When you export a model to simulink, if the model contains sub/nested blocks with Activity Diagrams, the compiler reports multiple linker errors. []error LNK2019: unresolved external symbol "public: virtual __cdecl OMActivityManager::~OMActivityManager(void)" (??1OMActivityManager@@UEAA@XZ) error LNK2019: unresolved external symbol "public: virtual __cdecl OMActivityContext::~OMActivityContext(void)" (??1OMActivityContext@@UEAA@XZ) error LNK2001: unresolved external symbol "public: virtual void __cdecl OMActivityNode::connectOutputFlow(class OMActivityEdge &)" error LNK2001: unresolved external symbol "public: virtual void __cdecl OMAction::visit(void)" (?visit@OMAction@@UEAAXXZ)[]

Cause

A structure with nested blocks/classes where a lower level block/class has an activity diagram:


Rhapsody Activity Diagrams are located in a separate section of the Object Execution Framework (OXF). With the above model it may be necessary to explicitly add this library to the MATLAB build script.

Resolving The Problem

As well as generating the project source code, Rhapsody also generates a MATLAB script which tells MATLAB Simulink how to build the project source code. This script is based on several templates located in the <RhapsodyShare>/etc/S_FunctionTemplates directory. There are different scripts for language (C/C++) and export action (Export and Export with Animation):


A. Simulink Export:

1) open <RhapsodyShare>/etc/S-FunctionTemplates/C++/build_sfunction_tmpl.m
2) Before, the $(WinmmLib) line add "$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsim$(LibExtension)"

For example:

mex
$(CompileSwitches)
COMPFLAGS="$COMPFLAGS $(LIBCRT_FLAG)"
-D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
-I.
-I"$(OMROOT)/LangCpp"
-I"$(OMROOT)/LangCpp/oxf"
-I"$(AdaptorSearchPath)"
-I"$(OMROOT)/Profiles/Simulink"
$(SourceFiles)
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimer.cpp"
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimerFactory.cpp"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxf$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsim$(LibExtension)"
$(WinmmLib)
$(WebifyLibs)


B. Simulink Export with Animation:

1) open <RhapsodyShare>/etc/S-FunctionTemplates/C++/build_sfunction_tmpl_anim.m
2) Before, the $(SocketLib) line add "$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsiminst$(LibExtension)"

for example:

mex
$(CompileSwitches)
COMPFLAGS="$COMPFLAGS $(LIBCRT_FLAG)"
-D_OMINSTRUMENT
-DOM_WITH_CLEANUP
-D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
$(LinkerFlags)
-I.
-I"$(OMROOT)/LangCpp"
-I"$(OMROOT)/LangCpp/oxf"
-I"$(AdaptorSearchPath)"
-I"$(OMROOT)/LangCpp/aom"
-I"$(OMROOT)/LangCpp/tom"
-I"$(OMROOT)/Profiles/Simulink"
$(SourceFiles)
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimer.cpp"
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimerFactory.cpp"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxfinst$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)aomanim$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)omComAppl$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsiminst$(LibExtension)"
$(SocketLib)
$(WinmmLib)
$(WebifyLibs)


The same instructions should be applied to the <RhapsodyShare>/etc/S_FunctionTemplates/C templates if C is the language being used.

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.5;8.0.6;8.1;8.1.1;8.1.2;8.1.2.1;8.1.3;8.1.4;8.1.5;8.2;8.2.1;8.3","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg22016240