M
mmobile
How to I pass(marshal) a reference in managed code to a unmanaged code
function?
For example:
In my unmanaged code I have a function like:
int InsertItem(HWND hWnd, long tag)
In my managed code I declare
class TestApp
{
...
[DllImport("Test.dll")]
public extern static int InsertItem(InPtr hWnd, long tag)
...
TestApp()
{
TestApp.InsertItem(this.hWnd, this.myObject); // How do I pass the
reference(address) of this.myObject????????????
}
}
All I want to do is store the reference(address) to the object in the
managed code. I won't be accessing the object from the managed code.
function?
For example:
In my unmanaged code I have a function like:
int InsertItem(HWND hWnd, long tag)
In my managed code I declare
class TestApp
{
...
[DllImport("Test.dll")]
public extern static int InsertItem(InPtr hWnd, long tag)
...
TestApp()
{
TestApp.InsertItem(this.hWnd, this.myObject); // How do I pass the
reference(address) of this.myObject????????????
}
}
All I want to do is store the reference(address) to the object in the
managed code. I won't be accessing the object from the managed code.