[quoted text, click to view] "PLS" <nobody@nowhere.com> wrote in message
news:MPG.1ff0e3aa64f3d53d989680@msnews.microsoft.com...
> I'm having a problem hosting the CLR in a C++ program.
>
> I want to C++ program code to be agnostic about runtime versions, so I
> can make the runtime version be a configuration parameter.
>
> The sample I have shows passing the runtime version to
> CorBindToRuntimeEx. So far, so good. But it also shows
>
> #import "C:\\WINNT\\Microsoft.NET\\Framework\\v1.0.2914
> \\Mscorlib.tlb" raw_interfaces_only
>
> Doesn't this import tie the program to a specific runtime version? Is
> there a way around importing this type library? I see that mscoree.h
> does not include the COM interface definitions the CLR uses.
>
> Pardon me if this is the wrong group to post this question.
Well, the compiler uses the import statement to create C++ wrapper classes.
We are dealing with interfaces more than anything else. If you run the
dependency walker or the linker's binary dump utility you will see that the
application in which you have the compiler directive is _not_ importing
functions in the Win32 sense to create a dependency on a specific DLL.
Just by the way ...
.... what I can tell you though is that it does get dicey when you start to
debug.
In an application of mine, I do host the runtime. And I had hoped that by
loading the CLR myself and deferring the load until after I read my
configuration that I would be OK.
What I have found recently is that is all well and good, up to the point of
debugging both the managed and native pieces of an application. Then the IDE
will get in the way.
By default, when you start to debug in _mixed_ mode, the VS 2003 IDE will
load the most recent version of the framework. That's bad if you have
version 2.0 or 3.0 of the framework installed because the IDE debugger is
itself a 1.1 application. Catch 22.
The issue and workaround are described here:
http://blogs.msdn.com/jmstall/archive/2005/12/05/VS2003_crashes_with_2005.aspx Sadly, that makes an application much less agnostic about version.
Regards,
Will