Hello,
Suppose I want to call a DLL function that receives a SINGLE and returns a LONG.
The only way I can get this to work at this point is to DIM a AS LONG in the DLL,
and then EXPORT it AS SINGLE to a LONG in the main EXE. I know this is not the way
to do this. In the DLL, how can I:
instead of EXPORT AS SINGLE? EXPORT AS LONG always returns a 0 in PBMAIN's MsgBox.
What is the simplest way to do this?
DLLTEST2.DLL:
[code]
#COMPILE DLL
FUNCTION TestFloattoInt (x AS SINGLE) EXPORT AS SINGLE
DIM a AS LONG
MSGBOX "PowerBasic DLL Message: Input value is " + STR$(x)
a=x
TestFloattoInt = a
END FUNCTION
------------------
Suppose I want to call a DLL function that receives a SINGLE and returns a LONG.
The only way I can get this to work at this point is to DIM a AS LONG in the DLL,
and then EXPORT it AS SINGLE to a LONG in the main EXE. I know this is not the way
to do this. In the DLL, how can I:
Code:
FUNCTION TestFloattoInt (x AS SINGLE) EXPORT AS **LONG**
What is the simplest way to do this?
Code:
#COMPILE EXE DEFSNG B-Z DECLARE FUNCTION TestFloattoInt LIB "DLLTEST2.DLL" ALIAS "TESTFLOATTOINT" (x AS SINGLE)' EXPORT AS LONG FUNCTION PBMAIN() AS LONG DIM a AS LONG x=32.155 a=TestFloattoInt(x) MSGBOX STR$(a) END FUNCTION
[code]
#COMPILE DLL
FUNCTION TestFloattoInt (x AS SINGLE) EXPORT AS SINGLE
DIM a AS LONG
MSGBOX "PowerBasic DLL Message: Input value is " + STR$(x)
a=x
TestFloattoInt = a
END FUNCTION
------------------
Comment