[clean-list] Building to DLL??

John van Groningen johnvg at cs.ru.nl
Wed Feb 1 17:30:56 MET 2012


On 31-1-2012 13:39, Alan Carlyle wrote:
> Hi Clean List,
>
> Could someone point me in the right direction to build DLL using clean?
>
> I notice an option for this exists in the IDE yet I believe there may be
> some extra requirements that need to be meet.

To build a DLL:

- write a Clean module (or more) with functions exported using foreign 
export, see:

http://clean.cs.ru.nl/download/html_report/CleanRep.2.2_13.htm

Only these functions can be exported from a DLL.

- create a text file with the exported function names.
   For each function a line:

external_function_name:=internal_label_name_of_the_function

If for example a function f with C calling convention is exported, use:

f:=_f

The extra _ is necessary because the C compiler adds it, so the Clean 
compiler has to do this as well.

- enable Generate DLL in the Linker tab of the Project Options dialog.

- in the same dialog, click Set dll symbol source.. and select the text 
file with the exported function names.

- Use menu item Bring Up To Date, to build the dll.

> Also advice on consuming this DLL would be appreciated.

If you want to use the dll from Clean, see section 3.3 from 
CallingCFromClean.html in the Help folder or IDE menu item Help.

If you want to use the dll from visual C, you can use lib /def (from the 
command line) to build an import library.

> Kind Regards,
>
> Alan
>
> Oh, I’m building for 64bit windows.

Kind regards,

John van Groningen


More information about the clean-list mailing list