tags:

views:

235

answers:

1

Google translate :

The interpreter is created, an array of bytes into the array in a machine language to cast the enum type and function, I have made an approach to dynamically execute a function, reference Please tell me if the machine-language site.

Babelfish translate:

It is to make the interpreter, but inserting machine language in arrangement at the byte unit, but if it is it makes function dynamically with the approach that it arranges the very the cast, it executes that in functional type through enum, there is a sight of the machine language which becomes reference, please teach.

Original question:

インタプリタを作っているのですが、機械語をバイト単位で配列に入れて その配列をenumを通して関数型にキャストし、それを実行するというアプローチで関数を動的に作っているのですが、 参考になる機械語のサイトがあれば教えてください。

A: 

I'm going to make a guess - a pure guess:

You have an array of bytes containing the machine code for a function. How can you write a cast such that the function can be executed?

In which case, the answer is likely to be:

In most modern operating systems, the system protects you from converting data into executable code. The best way to deal with it would be to package the code as a function in a dynamically-loaded (shared) library, and then use the standard calls for the operating system to load that library and execute the function.

Jonathan Leffler