Interface with C

John van Groningen johnvg@cs.kun.nl
Tue, 2 Jun 1998 11:59:53 +0200


Ana wrote:
> ...
>Everything worked fine. Then, I tryed a more substantial task. In few
>words, I tryed to add the program below to a Clean application. Since
>the program requires the library Winmm.lib, I used the link options
>to add it as well. Clean compiled the application and generated
>an executable file. However, the file didn't execute. It complained
>that there were a DLL missing (ARCH.DLL). I never heard about that
>DLL. In fact, I couldn't find it in the system. By the way, I use
>this C program and the Winmm.lib in my Visual Prolog applications,
>and I never had any problem with a missing DLL.=20

Library files (.lib) are not supported by the linker on Windows, only object=
 files. To be able to call functions in a dll, the Clean linker uses text=
 files consisting of the name of the dll, on the first line, and the names=
 of the functions exported by this dll on the following lines (one function=
 name per line). See for an example the file 'kernel_library'.

To call the function 'mciSendCommand' create a text file 'mci_library' that=
 contains the following 2 lines:
winmm.dll
mciSendCommandA@16

Then append 'mci_library' to the libraries in the link options dialog. Do=
 not link winmm.lib.

John van Groningen