How can I link in code I have written into an OPNET simulation? How do I use External Code Files?

Categories:
Solution Number:
S20589
Last Modified:
2013-08-20
Issue

How can I link in code I have written into an OPNET simulation? How do I use External Code Files?

Solution

This can be done by using External Object Files. External Object Files are useful in that they allow the user to centralize often-called functions into one file, which many separate process models can call without having to repeat code.In order to make calls to an External Object file from within a process model, the External Object File must be declared, either in the Process or Network/Project Editor. For this to happen, the code must be compiled, have the file suffix .ex.o, and reside in one of the user's model directories (as specified in the mod_dirs preference). To compile code into an External Object file is to use the command:prompt> op_mko -type ex -m <external code file name>In OPNET 7.0 or later, you can use the above command from an OPNET Console, or open and compile the source file directly in the tool. To do this selectopen from the file menu and selct External Source (C Code) or External Source (C++ Code) as the type of file to open. Click the compile source codebutton in the code editor to compile the external code file(*.ex.c) into object code (*.ex.o)For more information on the op_mko utility, see the Program Descriptions chapter of the OPNET External Interfaces Manual.An alternative to declaring External Object Files is to set up OPNET such that whenever it runs a simulation, it binds in a fixed set of libraries (perhaps libraries from a non-OPNET application that is often used in a user's code). The Environment Attribute bind_shobj_flags will need to be set to include the desired libraries. For information on doing this, please see the OPNET External Interfaces Manual, Chapter External Compiler Interface, or see FAQs 47 and/or 380 from www.opnet.com/support.

Environment

Compiling/Linking

Attachments
NOTICE: Riverbed® product names have changed. Please refer to the Product List for a complete list of product names.
Can't find an answer? Create a case