This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
dll argument passing between vb and gcc
- To: "'Gnu Mailing list'" <gnu-win32 at cygnus dot com>
- Subject: dll argument passing between vb and gcc
- From: Ian Collins <Ian at kiwiplan dot co dot nz>
- Date: Tue, 18 Nov 1997 16:30:12 +1300
(Thanks for reply on earlier posting: jeffdbREMOVETHIS@netzone.com. It
worked).
I am trying to get vb5 talking to a dll created by gcc under gnu-win32
(It's not a case of want to, but have to).
Integer passing works fine. An int in gcc is a long in vb.
String (char*) and double (float) passing is interesting however, and I
wonder if anyone has done it or can point me in the right direction.
Take for example the following examples,
Example 1: getting floating point number between vb and the dll.
In the gcc dll,
float floatvalby2(i)
float i;
{
return i*2;
}
The vb caller is,
Private Declare Function floatvalby2 Lib "e:\usr3\ian\myc" (ByVal f
As Double) As Double
Dim myf1 As Double
Dim myf2 As Double
myf1 = 123.1
myf2 = floatvalby2(myf1)
This gives me a suitably cryptic "Expression too complicated error" on
execution of the vb floatvalby2 call.
Example 2: getting character strings between vb and the dll.
In the gcc dll,
void subbackstr (str)
char *str;
{
strcpy(str, "This is a string");
}
The vb caller is,
Private Declare Sub subbackstr Lib "e:\usr3\ian\myc" (ByRef instr As
String)
dim str as string
str = "This is the initial string"
Call subbackstr(str)
This dumps vb with a dr watson.
(I have also tried allocating the memory from the heap in the gcc
routine and returning the required string as a function,
which also gives the same result).
(and people say Unix is complicated!)
Ian Collins.
KIWIPLAN NZ.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".