[mercury-users] Is it possible to write dynamic link library for Windows OS in mercury?

Peter Ross pdross at gmail.com
Fri Oct 23 08:59:43 AEDT 2009


On Fri, Oct 23, 2009 at 3:41 AM, Dmitry Negius <thenegius at gmail.com> wrote:
> Hi all.
> Is it possible to write dynamic link library for Windows OS in Mercury
> language?
> If so then how? Thank you.
>
Who is going to access this DLL?  Another mercury program or a program
written in C/C++?

The build system under windows doesn't currently allow one to create a
library which is exported as a DLL that can be consumed from another
mercury program.

If you want to create a DLL which is accessible from C this is possible though.

Add the :- pragma foreign_export(c, ...) declarations to your code.

Build you code as a library (you get a static library).

Write an interface in C which has the correct DLL declarations for a
set of functions and each function definition just calls the mercury
foreign exported function.

Then link the resulting object file and the static library together to
create a DLL.

-- 
Peter Ross - Mission Critical Australia
AU: +61 424 651 834
BE: +32 485 482 559
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list