Hello group,
I am using the unmanaged API to create assemblies, emitting methods
into it, adding VTableFixup-entries and then saving it to disk. Then I
use the managed methods from unmanaged code, using LoadLibrary/
GetProcAddress, which works fine. Pretty cool.
But..
The next step is to jump the generate-file-on-disk part and use
CeeFileGen's GenerateCeeMemoryImage() instead of saving it to disk and
this is where I am currently having issues.
My old code did GenerateCeeFile() in the end which wrote the HCEEFILE
to disk. I thought that GenerateCeeMemoryImage() could be used as a
replacement but it seems not.. see an excerpt of my code below and the
error message I get:
[ ... code which gets an ICeeFileGen instance and does emit-stuff
removed ... ]
void *p = NULL;
hr = ceefilegen->GenerateCeeMemoryImage(file, (void**)&p);
This fails with 183, "Error Already Exists" which I cannot make sense
out of. The sscli reference code for GenerateCeeMemoryImage() does not
return any such errors..
I would appreciate it if anyone with an insight into these things
could give me a hint or two on how to use the GenerateCeeMemoryImage
function.
/joakim
knattetjatte@googlemail.com - 14 Feb 2008 13:26 GMT
On Feb 13, 6:17 pm, "knattetja...@googlemail.com"
<knattetja...@googlemail.com> wrote:
> void *p = NULL;
> hr = ceefilegen->GenerateCeeMemoryImage(file, (void**)&p);
>
> This fails with 183, "Error Already Exists" which I cannot make sense
> out of. The sscli reference code for GenerateCeeMemoryImage() does not
> return any such errors..
For the archives..
It turns out you cannot set the output file name and then "change your
mind" and do GenerateCeeMemoryImage() so in my case I just had to
remove the call to SetOutputFileName() a bit earlier in the code and
it started working.
/joakim