[m-rev.] diff: add original module to list of C# DLL references.

Tyson Dowd trd at cs.mu.OZ.AU
Mon Aug 27 20:21:11 AEST 2001


Hi,

Many modules end up depending on themselves according to the normal
dependency calcuation (probably as a result of defining and then using a
type in their interface), but not all of them.  

In some cases this mean you couldn't use the procedures in a module from
pragma foreign_proc, as the module was not being imported by default.

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


Estimated hours taken: 0.5
Branches: {main}

compiler/modules.m:
	When calculating referenced modules for a C# DLL, include the
	module itself as one of the dependencies. 
	For example, math__csharp_code.cs should refer to math.dll.



Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.196
diff -u -r1.196 modules.m
--- compiler/modules.m	2001/08/20 14:07:20	1.196
+++ compiler/modules.m	2001/08/27 10:06:09
@@ -4045,8 +4045,8 @@
 	io__write_string(DepStream, FileName),
 	write_dependencies_list(Modules, Suffix, DepStream).
 
-	% Generate the list of .NET DLLs which could be refered to by this
-	% module.  
+	% Generate the list of .NET DLLs which could be referred to by this
+	% module (including the module itself.  
 	% 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
@@ -4054,15 +4054,18 @@
 	
 :- func referenced_dlls(module_name, list(module_name)) = list(module_name).
 
-referenced_dlls(Module, Modules0) = Modules :-
+referenced_dlls(Module, DepModules0) = Modules :-
+	DepModules = [Module | DepModules0],
+
 		% 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) ->
 			% In the standard library we need to add the
 			% runtime dlls.
-		Modules = [unqualified("mercury_mcpp"),
-				unqualified("mercury_il") | Modules0]
+		Modules = list__remove_dups(
+			[unqualified("mercury_mcpp"),
+				unqualified("mercury_il") | DepModules])
 	;
 		F = (func(M) =
 			( if 
@@ -4076,7 +4079,7 @@
 				unqualified(outermost_qualifier(M))
 			)
 		),
-		Modules = list__remove_dups(list__map(F, Modules0))
+		Modules = list__remove_dups(list__map(F, DepModules))
 	).
 
 	% submodules(Module, Imports)

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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