473,324 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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_CALLBACK)( unsigned char* tagmem);

I tried this for my callback definition:

Public Delegate Sub CallbackDelegate( 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.

Aug 7 '06 #1
0 772

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bryan Olson | last post by:
The current Python standard library provides two cryptographic hash functions: MD5 and SHA-1 . The authors of MD5 originally stated: It is conjectured that it is computationally infeasible to...
8
by: kurtcobain1978 | last post by:
-------------------------------------------------------------------------------- I need to do the exactly same thing in VB.NET. Load a unmanaged C DLL dynamically and then call a function in...
8
by: Eric Lilja | last post by:
Hello, I have IPv4-numbers in the following format: "\\x0A\\x11\\x8C\\x01" Now I need each byte as an int. I wrote the following test program: #include <stdio.h> #include <stdlib.h> static...
3
by: christophe.verne | last post by:
Hi all, It's the first time I'm using groups so i hope I am posting on the good group. I''m not familiar with callback and function pointer and here is what I'd like to do: typedef struct...
4
by: Kyku | last post by:
Hello all, I'm in a process of writing a small Linux C++ program for discovering repeaded files over a filesystem. One part of this task is traversing a directory structure. This is done by the...
4
by: uche | last post by:
can someone please look at this code and decipher it for me....i've been stressed by it! ============================================= //disk.cpp #include "disk.h" #include <cstdlib> #include...
0
by: DavidT | last post by:
Hello, at first, exuse if the following question is simple to solve, but i normaly coding with C# and now have to use C++/CLI for one project. My Problem is that i have to use a native c++ sdk...
40
by: Angus | last post by:
Hello I am writing a library which will write data to a user defined callback function. The function the user of my library will supply is: int (*callbackfunction)(const char*); In my...
5
by: Jef Driesen | last post by:
I have a C DLL that I want to use from a C# project. The C header file contains these declarations: typedef void (*callback_t) (const unsigned char *data, unsigned int size, void *userdata);...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.