How do I link in external libraries to OPNET on Windows?
How do I link in external libraries to OPNET on Windows?
The following instructions will let you link external DLLs into your...
dynamic simulations
static simulations
EMA programs
repositories
internal execution ETS event-handler libraries
For the sake of example, say that you want to link against the libraries
"aaa.dll" and "bbb.dll", which are in "c:\mydlls". Say the corresponding
.lib files (aaa.lib, bbb.lib) are in "c:\mylibs"
1. Make sure the required header file(s) are #include'd in the Header Block
of your process model (or pipeline stage, or external C/C++ file).
2. Go to Edit->Preferences...
A. Add to your "bind_shobj_flags" "/LIBPATH:c:\mylibs"
You may skip this step if the directory is already in your Windows
system "lib" environment variable.
(My Computer->Properties->Environment)
*Note that if the .lib files are located in multiple directories you
will have multiple /LIBPATH:<dir> items in your bind_flags.
B. Add to your "bind_shobj_libs" "aaa.lib bbb.lib", where aaa.dll and
bbb.dll are the libraries you're linking against (of course you may
have one or more libraries here.
3. Make sure "c:\mydlls" is in your Windows system "path" environment variable.
(My Computer->Properties->Environment)
You should be all set!
*Note that if you are creating a static simulation or an EMA program,
you will want to edit "bind_static_flags" and "bind_static_libs" instead of
"bind_shobj_flags" and "bind_shobj_libs" as described above.
Compiling/Linking