From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding an user library to a SystemBuild "User Code Block"

Hi,
 
I would like to add a library (.lib file) to a User Code Block. What is the easyest way to do it?
 
Thanks.
 
0 Kudos
Message 1 of 2
(8,608 Views)
For users to link their own libraries to their UserCodeBlock dlls, they will need to create a "Named Library UCB" block in their model.
What we mean by named library is that the "Library Name" parameter in the UserCodeBlock dialog must be non-blank (ie. mylib).
Blank Library Name UCBs are always linked into simucb.dll (default) whereas named library UCBs are linked into libraryname.dll (ie. mylib.dll)

To specify a user libraries to link with for a named library UCB, enter the following Xmath code before running the SystemBuild simulation.

> mylib = simlib()            # Create the simlib MSO mylib
> mylib.library = ["c:/workucb/lib1.lib","c:/workucb/lib2.lib"]   # Specify your libraries to link to
> _simlibs.mylib = mylib;     # Copy mylib MSO to the _simlibs partition (sim looks for simlib MSOs in this partition)
> showsimlib mylib            # Show the contents of the mylib MSO to verify its contents (optional)
> y = sim("mymodel",t,u);     # sim will link mylib.dll with lib1.lib and lib2.lib before running sim

See the Building, Linking and Debugging UCBs section in Chapter 14 pg 14-34 of the MATRIXx 8.0 SystemBuild User Guide for more details.

Bob Wilson
MATRIXx R&D
0 Kudos
Message 2 of 2
(8,592 Views)