% Have C invoke Mercury as standalone.
% Initial files: Makefile, c_main.c, mercury_lib.m.
% c_main is the resultant executable.
% make realclean ;; start over.

% RUN
% standalone_c 490>./c_main 

:- module mercury_lib.
:- interface.
:- import_module io.

:- pred  main(io, io).
:- mode  main(di, uo) is det. 

:- implementation.
:- import_module list, string, bool, int.

:- pragma foreign_export("C", main(di, uo), "main").
main(In, Out) :-
	format("%s\n", [s("STANDALONE")], In, Out). 


% These are required.
%-----------------------------------------------------------------------------%
%
% Initialiser for this library
%

:- initialise initialiser/2.

:- pred initialiser(io::di, io::uo) is det.

initialiser(!IO) :-
    io.write_string("mercury_lib: the initialiser has now been invoked.\n",
        !IO).

%-----------------------------------------------------------------------------%
%
% Finaliser for this library
%

:- finalise finaliser/2.

:- pred finaliser(io::di, io::uo) is det.

finaliser(!IO) :-
    io.write_string("mercury_lib: the finaliser has now been invoked.\n",
        !IO).

:- end_module mercury_lib.
