If I have a variable, how do I turn it into a list of bytes or a string containing its value as it's stored internally? To better illustrate what I mean, what I want to do could be done in C with (char*)&variable, and then indexing the resulting pointer as an array. In case I wasn't clear enough before, what I want is the value in its internal form as Mathematica stores it.
For anyone asking why I need this, say there's a package I have that was encoded using the Encode function. I want to view the code for a function in the package, but that function's attributes are {ReadProtected, Locked}. If I knew the way that list was stored internally however, I could search for that data in the kernel's memory and replace it with an empty list, allowing me to view the code. In case anyone's wondering, I don't actually have a package I need to view the code of right now, but I'd like to know I can do it if I want to.
CompiledFunctionwhich is compiled on the Wolfram Virtual Machine, then there are some informations on the register level can be get by analyzing theCompiledFunction. See documentation ofCompilePrintfor more details. – Silvia Jan 6 at 11:39Encode. Not only is it likely to raise WRI's ire, but also this is the only practical method available to third party package developers to protect their code. As such, to answer would both risk losing WRI's support for our efforts here and actively discourage third party package development. – Oleksandr R. Jan 8 at 10:26