[Gambas-user] Migrate VB6 project to Gambas 2.0 ?

Benoit Minisini gambas at ...1...
Mon Feb 11 22:09:31 CET 2008


On samedi 9 février 2008, 2020 wrote:
> Hello folk,
>
> I am trying to migrate a VB6 project to Gambas 2.0.
>
> My VB6 project require ftd2xx.dll, but in xubuntu 7.10 I will used ftdi_sio
> driver (FTDI USB Serial Device converter).
>
> All I want to do is to call FTDI functions from Gambas 2.0 project.
>
> Snippet code from my VB6 project;
> Private Declare Function FT_Open Lib "FTD2XX.DLL" (ByVal intDeviceNumber As
> Integer, ByRef lngHandle As Long) As Long
>
> Any ideas, thanks in advance.
>
> Sylvain.

You must tell me the prototype of the function in C to be sure. So the 
following *may* work:

It is a bit complicated in Gambas 2, because VarPtr() exists only in Gambas 3.

--8<---------------------------

PRIVATE EXTERN FT_Open(intDeviceNumber AS Integer, plngHandle AS Pointer) AS 
Integer

...

DIM plngHandle AS Pointer = Alloc(8)
DIM lngHandle AS Integer
DIM iRet AS Integer

iRet = FT_Open(..., plngHandle)
READ #plngHandle, lngHandle

--8<---------------------------

Tell me if it works.

Regards,

-- 
Benoit Minisini




More information about the User mailing list