ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

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
(9,294 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
(9,278 Views)