[m-rev.] diff: use /addmodule to reference library modules from C#.

Tyson Dowd trd at cs.mu.OZ.AU
Wed Aug 1 01:52:02 AEST 2001


Hi,

Pete actually wrote this change, I just cleaned it up a little
and posted it.

===================================================================


Estimated hours taken: 1
Branches: main

compiler/modules.m:
	When compiling a C# modules that form part of the implementation
	of the standard library, use /addmodule to reference library
	modules, as the library modules are generated as modules, not
	assemblies (/r is used for all other C# modules).


Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.186
diff -u -r1.186 modules.m
--- compiler/modules.m	2001/07/27 20:32:33	1.186
+++ compiler/modules.m	2001/07/31 15:49:36
@@ -2275,8 +2275,17 @@
 			io__write_strings(DepStream, 
 				["CSHARP_ASSEMBLY_REFS-", 
 					ForeignModuleNameString, "="]),
-			write_dll_dependencies_list(ModuleName,
-				AllDeps, "/r:", DepStream),
+			{
+				ModuleName = unqualified(Str),
+				mercury_std_library_module(Str)
+			->
+				Prefix = "/addmodule:"
+			;
+				Prefix = "/r:"
+			},
+			write_dll_dependencies_list(
+				referenced_dlls(ModuleName, AllDeps),
+				Prefix, DepStream),
 			io__nl(DepStream)
 		;
 			[]
@@ -3967,16 +3976,24 @@
 	io__write_string(DepStream, FileName),
 	write_dependencies_list(Modules, Suffix, DepStream).
 
-:- pred write_dll_dependencies_list(module_name, list(module_name),
-		string, io__output_stream, io__state, io__state).
-:- mode write_dll_dependencies_list(in, in, in, in, di, uo) is det.
+	% Generate the list of .NET DLLs which could be refered to by this
+	% module.  
+	% If we are compiling a module within the standard library we should
+	% reference the runtime DLLs and all other library DLLs.  If we are
+	% outside the library we should just reference mercury.dll (which will
+	% contain all the DLLs).
+	
+:- func referenced_dlls(module_name, list(module_name)) = list(module_name).
 
-write_dll_dependencies_list(Module, Modules0, Prefix, DepStream) -->
+referenced_dlls(Module, Modules0) = Modules :-
 		% If we are not compiling a module in the mercury
 		% std library then replace all the std library dlls with
 		% one reference to mercury.dll.
-	{ Module = unqualified(Str), mercury_std_library_module(Str) ->
-		Modules = Modules0
+	( Module = unqualified(Str), mercury_std_library_module(Str) ->
+			% In the standard library we need to add the
+			% runtime dlls.
+		Modules = [unqualified("mercury_mcpp"),
+				unqualified("mercury_il") | Modules0]
 	;
 		F = (func(M) =
 			( if 
@@ -3989,7 +4006,13 @@
 			)
 		),
 		Modules = list__remove_dups(list__map(F, Modules0))
-	},
+	).
+
+:- pred write_dll_dependencies_list(list(module_name),
+		string, io__output_stream, io__state, io__state).
+:- mode write_dll_dependencies_list(in, in, in, di, uo) is det.
+
+write_dll_dependencies_list(Modules, Prefix, DepStream) -->
 	list__foldl(write_dll_dependency(DepStream, Prefix), Modules).
 
 :- pred write_dll_dependency(io__output_stream, string, module_name,

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list