[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[DotGNU]Poor man's mscoree.dll - working
From: |
Maciek |
Subject: |
[DotGNU]Poor man's mscoree.dll - working |
Date: |
Mon, 19 Apr 2004 23:13:52 +0800 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.6) Gecko/20040113 |
Hello,
I started playing with coremul last night and after figuring out how to
export the DLL function properly i came up with a _very simple_ solution
to mscoree.dll problem. Here's basically how it works:
pnet/coremul/shim.c:
__declspec(dllexport) __int32 _CorExeMain(void)
{
/* Get the full pathname of the application */
#ifdef _COR_REAL_WIN32
TCHAR path[1024];
GetModuleFileName(0, path, 1023);
STARTUPINFO si;
PROCESS_INFORMATION pi;
GetStartupInfo(&si);
char cmd[1100];
sprintf(cmd, "%s \"%s\"", "ilrun", path);
/* Execute 'ilrun "path/app.exe"' */
CreateProcess(
NULL,
cmd,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi);
exit(0);
#endif
return 0;
}
---
I've compiled the DLL (on mingw) this way:
cd coremul/
gcc -c cocreate.cpp
gcc -c guid.cpp
gcc -c shim.c
dllwrap --output-lib=libmscoreedll.a --dllname=mscoree.dll
--driver-name=gcc cocreate.o guid.o shim.o
---
As you can see, it's a really half-assed approach (EXEs only),
completely disregarding the way the 'shim' should work in real life.
Obviously, this approach only works on Windows, I don't even know if
mscoree.dll would be useful on other platforms. But it works for simple
testing, you no longer have to type 'ilrun app.exe' on Windows to
execute .NET applications.
If you're interested in having this until I come up with a better
solution, I can submit a patch.
Please let me know what you think about it.
Regards,
Maciek
- [DotGNU]Poor man's mscoree.dll - working,
Maciek <=