By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,107 Members | 1,562 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,107 IT Pros & Developers. It's quick & easy.

Callbacks of unmanaged code

P: n/a
I've to invoke a unmanaged dll fucntion in C# which uses
a callback fucntion.The unmanaged dll fucntion returns a
pointer to a structure to its callback fucntion.The user
should collect those structure fields in a buffer.

In my managed code(i.e. in C# program), I've used a
delegate for invoking callback function and I've declared
the structure too. The dll fucntion is executing finely
without any errors but I'm not getting any values into the
structure of my callback fucntion. Is there any problem
with the garbage collection.

I've gone through all the MSDN examples for PInvoke.
But they weren't of much use to me.

Please suggest me a solution of using callbacks of
Unmanaged code which take in a pointer to a struture.

Please send few code snippets which involve callbacks with
structure variables.

I need the information at the earliest.
Please send the information to my mail pe****@yahoo.com

Thanking you
vijaya


Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
vijaya,

If you can give the structure that is being passed in, as well as the
callback definition (both in C), then it would help.

Also, it is most likely that the structure is being passed by way of a
pointer. In that case, as a last resort, you can always set that parameter
to be of type IntPtr, and then marshal the structure manually.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"vijaya" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
I've to invoke a unmanaged dll fucntion in C# which uses
a callback fucntion.The unmanaged dll fucntion returns a
pointer to a structure to its callback fucntion.The user
should collect those structure fields in a buffer.

In my managed code(i.e. in C# program), I've used a
delegate for invoking callback function and I've declared
the structure too. The dll fucntion is executing finely
without any errors but I'm not getting any values into the
structure of my callback fucntion. Is there any problem
with the garbage collection.

I've gone through all the MSDN examples for PInvoke.
But they weren't of much use to me.

Please suggest me a solution of using callbacks of
Unmanaged code which take in a pointer to a struture.

Please send few code snippets which involve callbacks with
structure variables.

I need the information at the earliest.
Please send the information to my mail pe****@yahoo.com

Thanking you
vijaya

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.