Navigation: Clarion.Net (Clarion#) > Clarion# Language Extensions >Using a Clarion# DLL from Win32 Apps | |
Exporting Procedures in a Clarion# DLL for use in a Win32 program
1) In the Clarion# Program's GLOBAL MAP, add both the NAME and PUBLIC attributes to the PROCEDURE prototype
For example in your Clarion# global Map:
MAP
! Procedures exposed for Win32 access must have both the NAME and PUBLIC attributes
SayHello PROCEDURE(),NAME('SayHello'),PUBLIC
SayTheName PROCEDURE(string theName),NAME('SayTheName'),PUBLIC
END
2) On the Clarion# Project properties dialog, turn on the checkbox Export Global named procedures and create Clarion Win32 LIB file
This step causes a .LIB file to be created, its location is set according to your RED file, or you can specify the output path in the Project.
3) Copy both the .LIB and the Clarion# DLL to your Win32 project folder. You also must copy any assemblies (DLLs) that your Clarion# DLL references, for the minimum you need:
SoftVelocity.Clarion.Runtime.Procedures.dll
SoftVelocity.Clarion.FileIO.dll
SoftVelocity.Clarion.Runtime.Classes.dll
ClarionDrv.dll
4) In the Clarion Win32 program prototype the Procedure(s), and add the PASCAL and DLL attributes. If you need
to pass a string value by address also add the RAW attribute.
MAP
MODULE('ManagedDLL.dll')
! Calling Clarion# Procedures, you must use the PASCAL Attribute and set DLL(true)
SayHello PROCEDURE(),NAME('SayHello'),PASCAL,DLL(TRUE)
SayTheName PROCEDURE(*cstring theName),NAME('SayTheName'),PASCAL,RAW,DLL(TRUE)
END
END