List Info

Thread: VB6/GMP via PowerBasic Wrapper DLL




VB6/GMP via PowerBasic Wrapper DLL
user name
2006-07-05 12:27:09
hi
thanks for the reply,
i am still trying to run just the mpf_init  from VB6
i have compiled the following lines into the pbgmp.dll: the pb compiler v8.x does not issue errors:
#COMPILE DLL "pbgmp"
TYPE MPF
   ;      mp_prec AS LONG
 ;        mp_size AS LONG
 ;        mp_expt AS LONG
 ;        mp_limb AS LONG
END TYPE
      DECLARE SUB cMPFinit CDECL LIB "libgmp-3.dll" ALIAS "__gmpf_init" (X AS MPF)
 ;     DECLARE SUB cMPFclear CDECL LIB "libgmp-3.dll" ALIAS "__gmpf_clear" (X AS MPF)

SUB MPFinit ALIAS "mpf_init" (x AS MPF) EXPORT
    CALL cMPFinit(x)
END SUB
SUB MPFclear ALIAS "mpf_clear" (x AS MPF) EXPORT
    CALL cMPFclear(x)
END SUB
and put the pbgmp.dll with libgmp-3.dll and VB6 code in the same folder:
i run VB6 and write the following in a Module1.bas:
Type MPF
   ;      mp_prec As Long
 ;        mp_size As Long
 ;        mp_expt As Long
 ;        mp_limb As Long
End Type
Declare Sub mpf_init Lib "pbgmp.dll" (x As MPF)
Declare Sub mpf_clear Lib "pbgmp.dll" (x As MPF)
and in the Form :
Private Sub Command1_Click()
Dim n As MPF
mpf_init (n)
End Sub
but VB6 will issue the error message:
variable required - can't assign to this expression, highlighing the (n) in mpf_init (n)
whats wrong? i have looked at a code in the PurBasic forum:
http://www.purebasic.fr/english/viewtopic.php?t=10776&start=0&postdays=0&postorder=asc&highlight=&sid=1dc7bfe4a44f32ac9dcfb11f57ab8a80
there is a successfull code to call the GMP dll  about in the half part of the long page, ; i have tried it successfully,  the call to GMP dll is directly without a wrapper.
some of the first parts of the code:
Structure mpf ; multiprecision floating point
  mp_prec.l
  mp_size.l
  mp_expt.l
  mp_limb.l
EndStructure
x.mpf
y.mpf
z.mpf
CallFunction(1,"__gmpf_init2",x,256); initialize float number x with 256 bits precision
but i am still have a desire to Call GMP functions from VB6 , there are still millions of people who are using it for its simple, rapid and friendly way
please any suggestions,
thanks very much

2;


Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better.
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )