Files
mercury/extras/dynamic_linking/hello.m
Julien Fischer ec3b4b0c0e Fix the dynamic linking examples in extras.
Estimated hours taken: 0.5
Branches: main

Fix the dynamic linking examples in extras.

extras/dynamic_linking/dl_test.m:
extras/dynamic_linking/dl_test2.m:
extras/dynamic_linking/hello.m:
	Conform to name changes in the dl module.

	Clean up the code so that it conforms to our current coding standard.
2007-05-07 04:18:23 +00:00

50 lines
1.4 KiB
Mathematica

%-----------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%-----------------------------------------------------------------------------%
%
% Example module for use with dynamic linking.
% The driver program dl_test.m dynamically loads the object code
% for this module and then calls the procedures defined here,
% e.g. hello/2.
%
% This source file is hereby placed in the public domain. -fjh (the author).
%
%-----------------------------------------------------------------------------%
:- module hello.
:- interface.
:- import_module float.
:- import_module int.
:- import_module io.
%-----------------------------------------------------------------------------%
% A very basic test: print "Hello world".
%
:- pred hello(io::di, io::uo) is det.
% Test passing floating point arguments.
%
:- func add3(float, float, float) = float.
% Test passing integer arguments.
%
:- func add3int(int, int, int) = int.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
:- implementation.
hello(!IO) :-
io.print("Hello, world\n", !IO).
add3(X, Y, Z) = X + Y + Z.
add3int(X, Y, Z) = X + Y + Z.
%-----------------------------------------------------------------------------%
:- end_module hello.
%-----------------------------------------------------------------------------%