|
-
May 22nd, 2012, 09:34 AM
#1
Thread Starter
Member
[RESOLVED] How to call C-Dll with char[] signature
Hi all,
I tried the search (forum / google) before, but unfortunately I found no solution.
From VB.NET I have to call a very old c-dll, the methods have signatures like this:
Code:
int __stdcall getNumber();
int __stdcall getValue(char val1[256]);
I'm able to call the getNumber Method to retrieve an integer value.
With the Method getValue I have to retrieve a value into my VB app,
but everything I tried, I get an access violation within my VB app.
Using old VB6 the following worked:
Code:
Private Declare Function getMessage Lib "val.dll" (ByVal val1 As String) As Long
...
dim sTest as String*256
...
Call getMessage(sTest)
...
In VB I tried the method-declaration with IntPtr, FixedLengthString, Char(), Byte() and so on, but with no success. I now, that char* declarations can be handled with the Stringbuilder, but that seem not to work in this case, as the declaration is a char[256] and no pointer.
So how to declare the c-method above to be used in VB.NET?
Any hints are welcome!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|