can not create .cps from Gtk# glib-sharp.dll


C:\Program Files\GtkSharp\2.12\lib\gtk-sharp-2.0> PeToCps glib-sharp.dll
PeToCps: version 1.3.10 of 15 November 2010
PeToCps: System.InvalidCastException:
PeToCps: System.InvalidCastException: Unable to cast object of type 'QUT.PERWAPI.ClassDef' to type 'QUT.PERWAPI.ClassRef'.
at QUT.PERWAPI.NestedClassRef.ResolveParent(PEReader buff, Boolean isExtern)
at QUT.PERWAPI.PEReader.CheckForRefMerges()
at QUT.PERWAPI.PEReader.ReadMetaDataTables()
at QUT.PERWAPI.PEReader..ctor(PEFile pefile, FileStream file, Boolean refs, Boolean skipBody)
at QUT.PERWAPI.PEReader.ReadPEFile(String filename, Boolean skipBody)
at QUT.PERWAPI.PEFile.ReadPublicClasses(String filename)
at PeToCps.PeToCps.Process(Char[] nam, Int32& rVl)
PeToCps: Input file <glib-sharp.dll> error <System.InvalidCastException:>
PeToCps: Summary: 1 input files 1 failed
Gtk# can be downloaded from here: http://www.go-mono.com/mono-downloads/download.html (version 2.8.2)


k_john_gough wrote Jan 25, 2011 at 6:38 AM

Hi all. Ok, I shall have a look at it when I get a chance. Hopefully within a week or so.

StefanDD wrote May 30, 2011 at 2:27 AM

In 2006, I sent a bug report as follows (because i think it might be related)

I encountered a problem with the name mangling scheme as applied by petocps.exe. I am trying to develop a small application which makes use of an assembly called "gtk-sharp.dll". Even though petocps successfully creates a gtk-sharp_Gtk.cps file, it is rejected by the compiler in the IMPORT list as dashes are illegal chars in module names. I tried to fix the problem by changing the function dotToLowline in n2state.cp (so as to in addition to dots replace dashes "-" with an underscore "_" too), but while this got me rid of the "; expected" error in the import list, the compiler now panicked. So I guess, the problem is a little more complicated under the hood. I strongly suggest to allow dashes in assembly names since this is common in Mono and related assemblies

wrote Feb 14, 2013 at 2:24 AM