Running pyc data from memory in C
<p>How would I run pyc data I have loaded in memory with Python.h? I'm using a proprietary file format that contains the compiled python code.</p>

<p>For example, I have the code</p>

<pre><code>FILE *fp;
long code_size;
char *code;

fp = fopen("file.format", "rb");
fread(&amp;code_size, sizeof(long), 1, fp);

if (code_size &gt; 0)
{
    code = malloc(code_size);
    /* the pyc data starts at offset 0x100 for example */
    fseek(fp, 0x100, SEEK_SET); 
    /* read the pyc into the allocated memory */
    fread(code, sizeof(char), code_size, fp);
    /* execute the pyc data somehow using functions in Python.h.. */
}

fclose(fp);
</code></pre>
