|
Re: How to add user library (Linux) [message #781278 is a reply to message #781057] |
Fri, 20 January 2012 22:18 |
Sasha Slijepcevic Messages: 115 Registered: July 2009 |
Senior Member |
|
|
Kawada,
you can do something similar to what we talked about in an earlier thread. You need a new wrapper package, let's call it wrapPkg, whose only purpose would be to deliver an already built library when needed, just like here.
In package.xs in the wrapper package, you would implement getLibs() that returns some user space library.
Then, your cfg script would load the wrapper package, which would then caused the user space library to be added to the generated linker command file:
var System = xdc.useModule ("xdc.runtime.System");
xdc.loadPackage("wrapPkg");
Now, depending on where and how you want to use the wrapper package, you may need to do some more work. For example, if you don't know the absolute path to the user space library at the time the wrapper package is build, or you want to use it on different systems which do not have the library located in the same place, your wrapper package may need to be more configurable.
You may need to add a module, let's call it Settings, with a parameter 'path', which is then used by the configuration script to specify the library's location. So, on one system, the config script would be:
var System = xdc.useModule ("xdc.runtime.System");
var Settings = xdc.useModule("wrapPkg.Settings");
Settings.path = "/usr/lib";
Your getLibs() function now has to use Settings.path to return the right library:
function getLibs() {
return (this.Settings.path + "someuser.lib";
}
Notice that you did not have to call xdc.loadPackage() in the second version of the config script. By calling xdc.useModule() you automatically call xdc.loadPackage() on the module's package. Also, 'this' in getLibs refers to the package because getLibs() is a package level function.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04147 seconds