Jump to content
  • Advertisement
Sign in to follow this  
carr

how to get a bytecode file ?

This topic is 3679 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, geniuses: To run a script file , angelscript takes two steps. first, compile the source file into bytecode, second, run it. all happpen at run time. I want to separate the two steps. e.g. compile source before run time to get a bytecode file. Then , load the bytecode file and run , i think, it's faster when running, and source code can't be seen, it's safe. so ,what's the APIs to compile the script and save it ?? thanks.

Share this post


Link to post
Share on other sites
Advertisement
You can save and load byte code with the functions asIScriptEngine::SaveByteCode() and asIScriptEngine::LoadByteCode().

Share this post


Link to post
Share on other sites
If you want security then you should not use precompiled bytecode. Use encryption instead.

The problem with the precompiled scripts is that it bypasses most of the compile time checks that the compile performs. So if you load a precompiled bytecode that have been manipulated by some hacker, you may actually open up your application to exploitations, such as buffer overruns, etc.

Now if you want to avoid the delay caused by compilations while loading scripts, but don't care about the potential security problem of hacked bytecode, then precompiled bytecode is the way to go. The security problem may be diminished somewhat by adding check-sums and other similar techniques to the precompiled bytecode.

Share this post


Link to post
Share on other sites
I remeber you motioned that the precompiled byte code is not platform independent, isn't it, Angel?
So think about this issue before you decide to use it.

Share this post


Link to post
Share on other sites
Well remembered. The saved bytecode is indeed highly platform dependent, as it is compiled to be compatible with the host application. Things such as pointer sizes and size of booleans (PPC use 4 bytes for a boolean) changes the bytecode.


Share this post


Link to post
Share on other sites
Quote:
Original post by dxj19831029
I remeber you motioned that the precompiled byte code is not platform independent, isn't it, Angel?
So think about this issue before you decide to use it.


perhaps you could compile the source code to byte code the first time the app is run on a machine, then store it in an encrypted archive of some kind.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!