Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
umesh
Visitor

can i create .so /.dll / module for roku?

Hi,

I am new to Roku application development. I am planning to write an application for Roku box. I would like to create a module which can be linked by my roku app either statically or dynamically. So, it is like creating .so/.dll and linking application with the module. I posted this message on 'Roku streaming player' forum (My mistake 😞 ) and someone directed me to this forum with short answer saying i can't create .so /.dll and link an application. I read through the developer guide and other developer documents available in the SDK and I searched this forum as well for the way to create modules but closest thing I got is 'Script Libraries'. The problem with the 'Script libraries' is source code is visible to the application developers, if i would like to share it with them. I would like to know about alternative approach where i can write a library which is similar to 'Script libraries' but is in binary format.

Any pointers / links / information will be highly appreciated.

Thanks
Umesh
0 Kudos
10 REPLIES 10
Trevor
Visitor

Re: can i create .so /.dll / module for roku?

There may be a way to do this, but it's very doubtful. The Roku box compiles the code to byte code so everything that we create with is text, there's no way to send in something already compiled and link it with non-compiled code. Script libraries is your only option.
*** Trevor Anderson - bloggingwordpress.com - moviemavericks.com ***
0 Kudos
RokuMarkn
Visitor

Re: can i create .so /.dll / module for roku?

As stated, the basic answer to your question is no. You could, I suppose, encrypt your library in some way and release the encrypted library along with a little Brightscript code that decrypts it and evals it. But since the decryption code would not be encrypted, it probably wouldn't take much work to reverse engineer it.

--Mark
0 Kudos
umesh
Visitor

Re: can i create .so /.dll / module for roku?

Thanks a lot Trevor and Mark for your valuable responses.Yes Mark you are right it can be decrypted without much effort. I think I have two more options which I can explore or get an opinion from expert developers like you and other forum members

1) Can i create a BrighScript component? The way we create an object of let's say CreatObject("roDeviceInfo"). Similarly CreatObject("MyComponent") where MyComponent is from my library
2) There is something called Roku NDK, i just came across to this while reading documents or forum post. Has anybody explored Roku NDK? If yes, can i achieve what I am really looking for?
I don't want to reveal source code of my component if i require to share it with other developers. So that is a primary objective.

For the Javascript there is something called "obfuscation", if something similar is available for BrightScript then also it is fine.

Any short of directions / pointers will greatly appreciated.

Thanks a lot
Umesh
0 Kudos
kbenson
Visitor

Re: can i create .so /.dll / module for roku?

While your code is submitted as text (it's an interpreted language, not a compiled one), it isn't available to any other channels or the owner of the box. It's locked into it's own sandboxed environment when run.

If the main purpose of wanting a shared object or code obfuscation is to prevent other channels from getting access to your code, I don't think that's much of an issue. If it's because you want to provide libraries for other developers to use (paid or not) but don't want to share the code, that's what licenses are for.

Obfuscation is generally accomplished by removing unnecessary formatting and randomizing variable names. BrightScript has more required formatting that javascript (although much of that can be done away with through use of : to chain statements), but to ensure that after altering your program it still runs correctly I think you would want to have a good grammar for the language and generate an AST so you could ensure whatever format your output is syntactically correct. At that point, you might as well just write a full BrightScript interpreter. (we have played with the idea... 😉
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
RokuMarkn
Visitor

Re: can i create .so /.dll / module for roku?

Hm, I read the OP's question as relating to creating a library that other app developers could use. Rereading it, I'm not sure that's what was intended.
In any case, I want to reiterate that applications are tightly sandboxed, and there is no need to worry about people or other apps reading your app's code, data, or registry entries.

--Mark
0 Kudos
Trevor
Visitor

Re: can i create .so /.dll / module for roku?

From http://sdkdocs.roku.com/plugins/viewsource/viewpagesrc.action?pageId=2130673
BrightScript compiles code into bytecode that is run by an interpreter. This compilation step happens every time a script is loaded and run. There is no separate compile step that results in a binary file being saved. In this way it is similar to JavaScript.


So while it's compiled there's no way to link already compiled code, as it doesn't save it nor does it look like it loads any already compiled code. If you're asking about handing out a library for other developers to use then it has to be in the clear code that everyone will be able to read and easily backward-engineer, obfuscation can be used to make that harder I guess. Otherwise Roku has you covered when it comes to putting out a public or private channel and they do protect your code so no one else can get to it. I'm pretty sure you meant sharing a library with other developers, as what else is the point of creating .so/.dll if not for other's use?
*** Trevor Anderson - bloggingwordpress.com - moviemavericks.com ***
0 Kudos
umesh
Visitor

Re: can i create .so /.dll / module for roku?

First of all thanks a lot to all for your responses, appreciated. 😄

I'm pretty sure you meant sharing a library with other developers, as what else is the point of creating .so/.dll if not for other's use?

Yes, you are right, it is about handing out a library for other developers to use.

If you're asking about handing out a library for other developers to use then it has to be in the clear code that everyone will be able to read and easily backward-engineer, obfuscation can be used to make that harder I guess

If library is in clear code then everyone will be able to read. If other developers have access to the library source code then they can easily reproduce without much effort for which we have put a lot of efforts 😞 .

In any case, I want to reiterate that applications are tightly sandboxed, and there is no need to worry about people or other apps reading your app's code, data, or registry entries.

I understand that other people and app's can not read my application code, data and registry. Thanks for making this clear though
0 Kudos
RokuJoel
Binge Watcher

Re: can i create .so /.dll / module for roku?

Well, you could theoretically create a non-visible channel that can be installed, and share your dev key with other developers, and theoretically, they could call functions within your channel and execute them... at least this is my understanding of the Channel Packaging and publishing document, you can create a suite of channels sharing a dev key and I believe you can execute functions from one package in another. Never tried it, might not work in practice.

-Joel
0 Kudos
kbenson
Visitor

Re: can i create .so /.dll / module for roku?

"umesh" wrote:

If library is in clear code then everyone will be able to read. If other developers have access to the library source code then they can easily reproduce without much effort for which we have put a lot of efforts 😞 .


Are you looking to make revenue from the libraries, or just don't want people copying?

If you are trying to make money, it really sounds like what you want is a real license for your code. Then you just hand the code to the licensee and they have the ability to change (or not, depending on the license) the code, but they can only legally use it if they are licensed. Charge for the license.

This is how many of the 3d game companies that make 3d game engines deal with selling their engines for other companies to use (e.g. Id and Epic). They license the code to paying companies and give them full source code to be changed as the licensee needs for their own project.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.