A
Atmapuri
Hi!
I have an unmanaged function:
void Fun1(void * Delegate1, void * Param);
which I call from managed code via PInvoke.
The managed Delegate1 is then called from unmanaged code
like this:
public static void Delegate1(void * Param)
{
...
}
This all works fine. The problem is that the "Param" I need
to pass to Fun1 is a big and complex managed object. If I don't pass it
to the function, I have to use global variable and the routine
is not thread safe. The Fun1 does end until all Delegate1 calls
have finished. (blocking call).
The question is therefore:
How can you pass a pointer to a managed object and have that
managed object than available within Delegate1 as the true CLR
object? If I define the type directly, the program simply halts.
Thanks!
Atmapuri
I have an unmanaged function:
void Fun1(void * Delegate1, void * Param);
which I call from managed code via PInvoke.
The managed Delegate1 is then called from unmanaged code
like this:
public static void Delegate1(void * Param)
{
...
}
This all works fine. The problem is that the "Param" I need
to pass to Fun1 is a big and complex managed object. If I don't pass it
to the function, I have to use global variable and the routine
is not thread safe. The Fun1 does end until all Delegate1 calls
have finished. (blocking call).
The question is therefore:
How can you pass a pointer to a managed object and have that
managed object than available within Delegate1 as the true CLR
object? If I define the type directly, the program simply halts.
Thanks!
Atmapuri