Re: Need a method to send byte arrays from Unmanaged C DLL to VB
- From: "TDC" <NOtcarvinSPAM@xxxxxxxxx>
- Date: 12 Jan 2007 11:44:58 -0800
Assuming you are in .NET and calling a C dll, you actually have a
number of options.
If you want bytes, then declare it as a ByVal byte array. Just be sure
you allocate the space (using redim for example) in the .NET side
before calling the C routine.
For text data, you can use a StringBuffer instead of a byte array.
HTH,
Tom
PS - The interop group is probably a better fit for this kind of
question in the future
Vince Castellano wrote:
Hello,
What is the proper way to send byte arrays (or strings for that
matter), from a C DLL to VB? I have tried by prototyping the call in VB
with ByRef Byte[] as a parameter, then treating it in C as a pointer to
unsigned char, and then I tried a memcpy, as well as using pointer
arithmetic to copy over byte per byte.
However, everything I try causes a runtime error regarding the stack
being unbalanced. I am sure I am doing this all wrong, however there
has to be a way to get a piece of memory from C into VB, and I just
can't find it, nor any information on it.
If this is not the proper group, please point me in the right
direction.
Thanks for any help,
Vince
.
- References:
- Need a method to send byte arrays from Unmanaged C DLL to VB
- From: Vince Castellano
- Need a method to send byte arrays from Unmanaged C DLL to VB
- Prev by Date: Re: Startup object
- Next by Date: Re: Windows Form Designer generated code
- Previous by thread: Need a method to send byte arrays from Unmanaged C DLL to VB
- Next by thread: Re: Need a method to send byte arrays from Unmanaged C DLL to VB
- Index(es):
Relevant Pages
|