Real Software Forums
http://forums.realsoftware.com/

Declare a Subroutine in a DLL in RB
http://forums.realsoftware.com/viewtopic.php?f=13&t=40098
Page 1 of 1

Author:  ColorMan [ Sun Jul 31, 2011 4:21 pm ]
Post subject:  Declare a Subroutine in a DLL in RB

I have read through many of the threads here on using Declare to bring a dynamic link library and its functions into a Real Basic program. But none of them have identified Sub proceedures as I used to use in VB6. in particular, I would build a user interface using VB6 and then write numerical analysis routines using Fortran or C++ and put the subs into a DLL. I would then declare the Subs and their DLL and call the routines.

I have not been successful in doing this with RB. One possible reason is that my Subs pass data to / from VB6 ByRef and not ByVal, except for strings).

Has anyone experience with using RB to call a subroutine out of a DLL?

Declare Sub My_DLL_Subroutine1 Lib "My_DLL.dll" (ByRef Anum1, ByRef Anum2, ByRef Asum)

ColorMan

Author:  kermit [ Sun Jul 31, 2011 4:41 pm ]
Post subject:  Re: Declare a Subroutine in a DLL in RB

Your DLL calling code wouldn't have worked on VB either.
ByRef is usually fine, but you need to be clear about WHAT you are passing Byref
No good sending a pointer to a variant or a 4 byte integer if you expect the DLL to be able to write to several hundred bytes of a string buffer.

How is the external function declared at source?

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/