[Mono-devel-list] Tao Glut library and NullReference in wrapper_mono_string

Kamil Skalski nazgul at omega.pl
Fri May 21 10:21:14 EDT 2004


Hi!

I've been playing with Tao (http://www.randyridge.com/Tao/Default.aspx) 
bindings to OpenGl and Glut libraries. I was succesful in running some 
tescases from Redbook examples from Tao sources, but some of them crached at 
very beginning:

Unhandled Exception: System.NullReferenceException: A null value was found 
where an object instance was required.
in (unmanaged) (wrapper managed-to-native) 
System.Object:__icall_wrapper_mono_string_to_utf8 (object)
in <0x00004> (wrapper managed-to-native) 
System.Object:__icall_wrapper_mono_string_to_utf8 (object)
in <0x0010b> (wrapper managed-to-native) Tao.Glut.Glut:glutInit 
(int&,System.Text.StringBuilder[])
in <0x000d4> Tao.Glut.Glut:glutInit ()
in <0x0000e> Redbook.Aaindex:Main ()

This is the first function called in program, but unfortunetly not all 
examples crach on it...


I took a look at Tao sources and glutInit function has the following code:

      public static void glutInit() { 
            string[] argsArray = Environment.GetCommandLineArgs(); 
            StringBuilder[] args = new StringBuilder[argsArray.Length]; 
            int argsLength = args.Length; 
 
            for(int i = 0; i < argsArray.Length; i++) { 
                args[i] = new StringBuilder(argsArray[i],       
argsArray[i].Length); 
            } 
 
            glutInit(ref argsLength, args); 
        } 

where glutInit (ref argsLength, args); 
is a call to native libGl.so library:

      [DllImport(GLUT_NATIVE_LIBRARY), SuppressUnmanagedCodeSecurity] 
        public static extern void glutInit(ref int argcp, StringBuilder[] 
argv); 


Has anyone tried running Tao on mono? I compiled its libraries from command 
line suppying -define:LINUX to compiler. The above exception seems to be 
mono-related bug, not Tao.
I also tried to compile Tao libraries with NAnt (the entire project uses it 
for building). I was almost succesful, but I failed on project's dependency 
on ildasm - it uses it to generate some keys for libraries. Is there any mono 
counterpart for building those keys or way to switch their building in NAnt?

Kamil Skalski



More information about the Mono-devel-list mailing list