
Romans_I_XVI
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2016
09:34 PM
How to use custom libraries?
So this is a fairly basic question I think...
I wanted to try and create a custom BrightScript library. According to this ...
https://sdkdocs.roku.com/display/sdkdoc ... tLibraries
... all I have to do is put the .brs file in the package's root directory. However, when I try to load it by calling
I get this
It doesn't matter if I point to my file, or I point to a file that doesn't exist, the error message is the same.
I've used things such as the v30/bslDefender.brs in the past with no problem but never my own. Anyone else done this sucessfully?
I wanted to try and create a custom BrightScript library. According to this ...
https://sdkdocs.roku.com/display/sdkdoc ... tLibraries
... all I have to do is put the .brs file in the package's root directory. However, when I try to load it by calling
Library "test.brs"
I get this
*** ERROR compiling /pkg:/source/main.brs:
Error loading file. (compile error &hb9) in pkg:/source/main.brs(2) 'test.brs'
It doesn't matter if I point to my file, or I point to a file that doesn't exist, the error message is the same.
I've used things such as the v30/bslDefender.brs in the past with no problem but never my own. Anyone else done this sucessfully?
3 REPLIES 3


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2016
10:31 AM
Re: How to use custom libraries?
"Romans_I_XVI" wrote:
So this is a fairly basic question I think...
I wanted to try and create a custom BrightScript library. According to this ...
https://sdkdocs.roku.com/display/sdkdoc ... tLibraries
... all I have to do is put the .brs file in the package's root directory. However, when I try to load it by callingLibrary "test.brs"
I get this*** ERROR compiling /pkg:/source/main.brs:
Error loading file. (compile error &hb9) in pkg:/source/main.brs(2) 'test.brs'
It doesn't matter if I point to my file, or I point to a file that doesn't exist, the error message is the same.
I've used things such as the v30/bslDefender.brs in the past with no problem but never my own. Anyone else done this sucessfully?
I believe that documentation is incorrect, and was written prior to the Roku platform, or at least prior to Roku firmware from the last several years.
The Library statement is to support system and external includes only.
For your own internal use, just put test.brs under your source directory and it will be implicitly included.
In other words, there's no difference between a "library" file and any other BrightScript source file in this context.

Romans_I_XVI
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2016
10:39 AM
Re: How to use custom libraries?
Alright that's what I needed to know, thanks.
It's unfortunate that there isn't stronger behavior, for instance it'd be cool if it supported remote hosted libraries. Such as...
Oh well. Thanks again.
It's unfortunate that there isn't stronger behavior, for instance it'd be cool if it supported remote hosted libraries. Such as...
Library "http://example-site.com/bslSomething.brs"
Oh well. Thanks again.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2016
11:45 AM
Re: How to use custom libraries?
"Romans_I_XVI" wrote:
It's unfortunate that there isn't stronger behavior, for instance it'd be cool if it supported remote hosted libraries. Such as...Library "http://example-site.com/bslSomething.brs"
Now that would be a perfect way to circumvent going through that pesky app submission review process, wouldn't it?
If so, that line above will be the only brightscript in the bundle - everything else we'll deem a "library".