Is it possible to write dynamic link library for Windows OS in mercury?

View: New views
2 Messages — Rating Filter:   Alert me  

Is it possible to write dynamic link library for Windows OS in mercury?

by Dmitry Negius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all.
Is it possible to write dynamic link library for Windows OS in Mercury language?
If so then how? Thank you.

--
Normal people grows old!@#

Re: Is it possible to write dynamic link library for Windows OS in mercury?

by Peter Ross-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 23, 2009 at 3:41 AM, Dmitry Negius <thenegius@...> 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@...
Administrative Queries: owner-mercury-users@...
Subscriptions:          mercury-users-request@...
--------------------------------------------------------------------------