CompuServe Thread

#BAD DLL CALLING CONVENTI

2 messages in this thread
#1434From: T.O.Oct 4, 1991 6:32 PM
Tried your suggestion with Borland C++ re DLL function that returns a double and could not make it work. The following code shows you how to do it. My DLL C function looks like this void FAR PASCAL MyDouble(char *ASCnum, double *dval) { *dval = 3216.78; (or whatever) } and my Vis Basic declaration looks like this: Declare Sub MyDouble Lib "mylib.dll" (Byval ASCnum$, DVal#) and then in the Basic proc Dim DoubleVal as Double DoubleVal = 0 Call MyDouble("12345", DoubleVal) and voila! DoubleVal has 3216.78 in it! hope this helps! There is 1 Reply.
#1586From: Jonathan Zuck (UFI)Oct 5, 1991 11:45 PM
T.O., I thought you were trying to create a *function* that returned a DOUBLE. If that is the case, the DLOUBLE to which I was referring is appended by VB YOU DON'T PUT IT IN YOUR DECLARE LIST. You put it in your paramter list in BC++ however, and return that address as your function result. Does that make sense? -=- Jonathan