From: James Britt Date: 2003-09-27T14:38:26+09:00 Subject: Re: RubyDotNet r4 and namespaces John R. Pierce wrote: > On Sat, 27 Sep 2003 10:44:00 +0900, James Britt wrote: > > >>I grabbed the r4 release of RubyDotNet from >>http://www.saltypickle.com/rubydotnet, and it works great (well, on my >>laptop. My main PC seems to have issues with multiple versions of the >>.net framework installed). > > > Very interesting....both of us (the developers) are running our machines with > both version of .NET (1.0 and 1.1) as we develop this product. Can you provide > us specific errors you are getting? If I run Learninga.rb, I get a WIndows message box, titled Microsof Visual C++ Runtime Library, with the message Runtime Error! Program c:\ruby\bin\ruby.exe R6029 -This program cannot run using the active version of the Microsoft .NET runtime Please contact that application's support team for more information. I'm thinking I have path or registry issues here, and may try to remove earlier installations and simply use 1.1. (I've had annoying experiences getting the framework installed, so I'm not convinced paths and registry entries are entirely correct.) > > >>I had no trouble writing my own C# class and calling it from Ruby >>(pretty sweet). But I if put my class in a namespace I can't get the >>Ruby code to find it. I get errors about an unknown constant (i.e., the >> namespace for the C# class). > > > Are you building your custom C# class under .NET 1.1? Are you referencing the > dll using a fully qualified path including extension? If so to both of these, > can you provide a copy of your class either on this mailing list or directly to > me (if it is too big). I'd like to see this. Yes to both. csc.exe tells me: C:\>csc Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4 for Microsoft (R) .NET Framework version 1.1.4322 Copyright (C) Microsoft Corporation 2001-2002. All rights reserved. (Curiously, I see now that I have assorted earlier version on the laptop as well. Not sure that matters, or they're of any value.) Here's the class: using System; using Neurogami; using BlogtariDotNet; namespace Neurogami { class Utils{ public static void db( string msg ) { Console.WriteLine( "[DBUG] " + msg ); } } } // namespace BlogtariDotNet { class BlogtariSample { static void Main( string[] args ) { try { DateTime today = DateTime.Now; Console.WriteLine( "The time is " + today.ToString() ) ; BlogtariSample bs = new BlogtariSample(); Utils.db( bs.parse( "Foobar" ) ); } catch ( Exception exception ) { Console.WriteLine( exception.Message ); } } public string parse( string s ) { return s + " "; } } // } Anyway, so long as the BlogtariDotNet namespace is left commented, and my Ruby code just calls BlogtariSample.new() directly, all is good. But trying to use the name space and calling BlogtariDotNet.BlogtariSample.new() fails. Thanks, and thanks for the outstanding code. James Britt