Callback from unamanaged code with unsigned char * parameter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • FishingScout

    #1

    Callback from unamanaged code with unsigned char * parameter

    Hello,

    I have an unmanaged dll that performs a callback to my application when
    some activity happens. The callback prototype that the dll wants to
    call looks something like this:

    typedef void (TAG_EVENT_CALL BACK)( unsigned char* tagmem);

    I tried this for my callback definition:

    Public Delegate Sub CallbackDelegat e( ByVal TagData() As System.Byte)

    The buffer that the unmanaged dll is pointing to is 1024 bytes but when
    my callback gets called, the TagData variable is always length=1.

    Is my prototype correct for the callback? I cannot specify
    TagData(1024) in the prototype so I don't know how the code would know
    that the buffer is 1024 bytes.

    Do I need to change the specification and call some MarshalAs methods?
    Can you please provide an example?

    Thank you.

Working...