TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: JOHN DUMAS
date: 1998-01-07 20:53:00
subject: using C++ in VB5

 * Crossposted from: C++ (FIDO)
'My VB5 declare 
Private Declare Function prttest Lib "a:\1sttry.dll" Alias
"@prttest$qv" () As Byte
 ^^^^^^^^^^^ found using c:> impdef look a:\1sttry.dll
                         c:> edit look.def
'Make VB5 get string from DLL
Private Sub Command1_Click()
Dim X As String
For Y = 0 To 15
X = X + Chr$(prttest()) 'get one char at a time using C++ DLL
Next Y
Command1.Caption = X
End Sub
//This is my Borland 4.5 C++ DLL
#include 
#include 
char _export _stdcall prttest( void ) // note (_stdcall)!
{
 static int y;    //Remember place between calls
 char string[] = "try to pass this";
 return string[y++];
}
//IDE Settings ON
Target:   Dynamic Library[.dll]
Platform: Win32 - GUI
Std Libs: OWL - OLE2 - Dynamic
Locale options ON
Calling:      C calling conventions
Compiler out: Autodependency info - Generate underscores
Source:       Borland Extensions ( This one worked )
Processor:    80386
The above setting may or may not be needed but thats where they 
were when info finally got transferred.
If someone wants to tell me how to send a whole sentence/array/string
other than this method using a Borland C++ DLL and Visual Basic 5
please send me a proven/(compiled and run) example.
otherwise I will just expand this "method" into general functions,
with number of elements parameters. 
... I fear explanations explanatory of things explained (A.Lincoln)
--- Blue Wave/DOS v2.20 [NR]
---------------
* Origin: The Witch City BBS *Salem,MA [978]745-1689 *Hayes 28.8 (1:101/301)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.