Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Using the DLCALL Function > Examples

R:BASE

Scroll Prev Top Next More

Example Usage From Within R:BASE:

 

-- BEGIN Demo.rmd

-- Declare the functions to be used from the DLL

STDCALL function 'MultInt' ( Integer ) : Integer

STDCALL VOID 'LCaseByREF' (ptr TEXT (30))

STDCALL function 'LCaseByVAL (ptr TEXT (60)) : TEXT (60)

 

--Set somme variables for use

Set VAR vTEXT TEXT = 'RBASE TECHNOLOGIES'

SET VAR vINT INTEGER = 128

SET VAR v1 INTEGER = 0

 

-- OPTIONALLY CALL DLLOAD

SET VAR v1 = (DLLOAD('DemoLib.dll'))

IF v1 = 0 THEN

 PAUSE 2 USING 'DemoLib.dll NOT LOADED.. EXITING'

 RETURN

ENDIF

 

SET VAR V1 = (dlcall('demolib.dll', 'changecase', vtext))

 

{ The Value for v1 will be null because ChangeCase is a procedure and doesn't

 RETURN A RESULT, but the value of vTEXT which is passed as a POINTER has been

 changed to 'rbase technologies'}

 

SET VAR v1 = (DLCALL('demolib.dll', 'MultInt', vINT))

 

--The value for v1 will be 256 the value returned from the function.

 

-- running the following against RRBYW20

SELECT (DLCALL('demolib.dll','lcasebyval', Company))=60 FROM +

Customer WHERE LIMIT = 2

 

{Yields the following output:

(DLCALL('demolib.dll','lcasebyval', Company)

------------------------------------------------------------

computer warehouse - ii

microtech university - i

}

 

SELECT ((ICAP2((DLCALL('demolib.dll','lcasebyval', Company))))) = 60 +

FROM Customer WHERE LIMIT = 2

 

{Yields the following otput:

((ICAP (DLCALL('demolib.dll','lcasebyval',

------------------------------------------------------------

Computer Warehouse - Ii

Microtech University - I

}

 

-- Optionally CALL DLFREE

SET VAR v1 = (DLFREE('DemoLib.dll'))

 

-- END Demo.rmd