|
-
Jan 10th, 2001, 07:21 AM
#1
Thread Starter
Hyperactive Member
I'm writing a DLL in C++ for VB. If i'm passing a string to a C Function, would I use char[255] or some character
array large enough to hold the string? Do I need any other
arguments.
Bababooey
Tatatoothy
Mamamonkey
-
Jan 10th, 2001, 01:08 PM
#2
Monday Morning Lunatic
No - you'd pass a pointer:
Code:
void func(char *pcString) {
...
}
And the VB prototype:
Code:
Declare Sub func Lib "whatever" (ByVal pcString As String)
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 10th, 2001, 01:48 PM
#3
Thread Starter
Hyperactive Member
Bababooey
Tatatoothy
Mamamonkey
-
Jan 13th, 2001, 10:48 AM
#4
Thread Starter
Hyperactive Member
Parksie (or anyone else for that matter)
I'm trying to get the C function to return a char back as well.
adding on to the above mentioned code, how do i get the
c func to return a char or string and also hvae the vb func
accept it?
Bababooey
Tatatoothy
Mamamonkey
-
Jan 13th, 2001, 11:33 AM
#5
Monday Morning Lunatic
To do that, you pass a pointer to a buffer (using char* / ByVal x as String), and a length.
I did an example on this for someone a while back, and here it is: http://www.parksie.net/StringDLL.zip
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 13th, 2001, 12:55 PM
#6
Thread Starter
Hyperactive Member
Thank you once again, i will try it
Bababooey
Tatatoothy
Mamamonkey
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
|