C
Chen Zhuo
Hi all experts,
We are having a problem with the exact time when a C# dll gets loaded in
managed C++. The scenario is like:
In managed.cpp:
#using MyCSharp.dll
class Test
{
static void func()
{
if (false)
{
call into MyCSharp.dll;
...
}
}
}
The situation is: when the outside caller calls Test::func(), the
MyCSharp.dll is NOT there (due to some installer constraint). By right,
since the if condition is always a false, we expect no problem for
running Test::func() because we don't actually use anything in
MyCSharpt.dll, however the OS still tries to load MyCSharp.dll at
runtime, and throws exception since the dll cannot be found.
So our questions are:
1. In this case, when is the exact time that the dll gets loaded? Are
there any official document for this assembly loading behavior?
2. Is there any way to make it work at runtime without removing the call
into MyCSharp.dll (we want to keep the code there but it will never get
executed during runtime)?
Your help is greatly appreciated.
Best regards,
Chen Zhuo
We are having a problem with the exact time when a C# dll gets loaded in
managed C++. The scenario is like:
In managed.cpp:
#using MyCSharp.dll
class Test
{
static void func()
{
if (false)
{
call into MyCSharp.dll;
...
}
}
}
The situation is: when the outside caller calls Test::func(), the
MyCSharp.dll is NOT there (due to some installer constraint). By right,
since the if condition is always a false, we expect no problem for
running Test::func() because we don't actually use anything in
MyCSharpt.dll, however the OS still tries to load MyCSharp.dll at
runtime, and throws exception since the dll cannot be found.
So our questions are:
1. In this case, when is the exact time that the dll gets loaded? Are
there any official document for this assembly loading behavior?
2. Is there any way to make it work at runtime without removing the call
into MyCSharp.dll (we want to keep the code there but it will never get
executed during runtime)?
Your help is greatly appreciated.
Best regards,
Chen Zhuo