Rhino Script Compiler Limitations

I’ve read through the main thread on the script compiler and done some basic tests myself (which have failed), but I was hoping that someone with working knowledge of the code behind the compiler could clarify a couple points for me.

I’m talking about python code exclusively here

@stevebaer, I remember you mentioning that the import statement does not play well with the compiler. I have several projects I’d like to protect, all of which are built on a combination of python std-lib modules (like math, time), rhino modules (sc, rs, RhinoCommon), random .NET libs (e.g. an OpenCV wrapper/image processing lib) and my own modules. It’s easy enough i suppose to break the compartmentalization of my own code and copy-paste everything into one file, but does this mean i need to copy the code from the other modules verbatim as well? Does one need to do anything special to have the references to rhinoscriptsyntax or RhinoCommon function properly in a compiled plugin? And how would i go about calling functions from a .NET assembly? does throwing the .dll file into the compiler take care of this?

I would really like to know if there’s a good(easy?) solution for protecting my code if i wanted to, say, prevent people from fiddling with it or sell it; more specifically, it would be AWESOME not to have to refactor thousands of lines of python into more thousands of lines of c# for a true plugin.

Even a C# plugin won’t protect your code, it can be fairly easily disassembled. Don’t know much about how python code is handled in the compiler, so can’t help you out there, sorry.

Yes, that’s a good point; I’ve done quite a bit of that myself with ILSpy and its a breeze. Do you know if its possible to use a .NET code obfuscator on a built assembly, or does that process need to happen before/during compilation?

I imagine it should work on existing assemblies, but I’ve never felt the need to obfuscate my code.