[Mono-list] Help in dealing with Mono/.NET PInvoke issue

Miguel de Icaza miguel at novell.com
Fri Jan 8 18:25:02 EST 2010


Hello,

> Any recomendations for a host GUI API?
> 
> Is the one used in MonoDevelop easy to reuse?

MonoDevelop is written using an entirely different API, the Gtk# API for GUI programming.    I do not think that you would be able to reuse this.

There is a slight chance that you could contact the authors of the Dock and have them remove the Win32 dependency, but chances are, it is not really easy to do.

> 
> Dinis Cruz
> 
> On 8 Jan 2010, at 21:36, Miguel de Icaza <miguel at novell.com> wrote:
> 
> > Hello,
> >
> >> I've just checked-in the code that contains this project, so now all
> >> relevant source code is on the O2Platform sourcecode
> >
> > You will likely need to find an alternative to this widget (the
> > DockPanel) as the code has some 24 P/Invokes, and chances are that the
> > code depends on those calls to provide the functionality.
> >
> >
> >>
> >>
> >> Here is the list of the PInvokes that (I think) are causing the
> >> problem
> >>      * Win32 Native
> >>        methods: http://code.google.com/p/o2platform/source/browse/trunk/SourceCode_3rdParty_Dlls/DockPanel/WinFormsUI/Docking/Win32/NativeMethods.cs
> >>      * Win32
> >>        Enums: http://code.google.com/p/o2platform/source/browse/trunk/SourceCode_3rdParty_Dlls/DockPanel/WinFormsUI/Docking/Win32/Enums.cs
> >> To easily replicate this, please use this project
> >> http://code.google.com/p/o2platform/source/browse/trunk/O2%20-%20All%
> >> 20Active%20Projects/O2Core/O2/O2.sln since it only loads up that GUI
> >> and when executed (OSx 10.6) throws this error message:
> >>
> >>
> >> Unhandled Exception: System.DllNotFoundException: user32.dll
> >>  at (wrapper managed-to-native)
> >> WeifenLuo.WinFormsUI.Docking.NativeMethods:SetWindowsHookEx
> >> (WeifenLuo.WinFormsUI.Docking.Win32.
> >> HookType,WeifenLuo.WinFormsUI.Docking.NativeMethods/ 
> >> HookProc,intptr,int)
> >>  at WeifenLuo.WinFormsUI.Docking.DockPanel+FocusManagerImpl
> >> +LocalWindowsHook.Install () [0x00021]
> >> in /Users/.../Projects/SourceCode_3rdParty_Dlls/DockPanel/ 
> >> WinFormsUI/Docking/DockPanel.FocusManager.cs:91
> >>  at WeifenLuo.WinFormsUI.Docking.DockPanel+FocusManagerImpl..ctor
> >> (WeifenLuo.WinFormsUI.Docking.DockPanel dockPanel) [0x00087]
> >> in /Users/.../Projects/SourceCode_3rdParty_Dlls/DockPanel/ 
> >> WinFormsUI/Docking/DockPanel.FocusManager.cs:130
> >>  at (wrapper remoting-invoke-with-check)
> >> WeifenLuo.WinFormsUI.Docking.DockPanel/FocusManagerImpl:.ctor
> >> (WeifenLuo.WinFormsUI.Docking.DockPanel)
> >>  at WeifenLuo.WinFormsUI.Docking.DockPanel..ctor () [0x000c8]
> >> in /Users/.../Projects/SourceCode_3rdParty_Dlls/DockPanel/ 
> >> WinFormsUI/Docking/DockPanel.cs:44
> >>  at (wrapper remoting-invoke-with-check)
> >> WeifenLuo.WinFormsUI.Docking.DockPanel:.ctor ()
> >>  at
> >> O2.External.WinFormsUI.Forms.O2GuiWithDockPanel.InitializeComponent  
> >> ()
> >> [0x00000] in /Users/.../Projects/O2 - All Active Projects/O2 Modules
> >> Using 3rd Party
> >> Dlls/O2_External_WinFormsUI/Forms/O2GuiWithDockPanel.Designer.cs:32
> >>  at O2.External.WinFormsUI.Forms.O2GuiWithDockPanel..ctor ()
> >> [0x0000d] in /Users/.../Projects/O2 - All Active Projects/O2 Modules
> >> Using 3rd Party
> >> Dlls/O2_External_WinFormsUI/Forms/O2GuiWithDockPanel.cs:24
> >>  at (wrapper remoting-invoke-with-check)
> >> O2.External.WinFormsUI.Forms.O2GuiWithDockPanel:.ctor ()
> >>  at
> >> O2. 
> >> External.WinFormsUI.O2Environment.O2DockPanel.getO2GuiWithDockPanel
> >> () [0x0000a] in /Users/.../Projects/O2 - All Active Projects/O2
> >> Modules Using 3rd Party
> >> Dlls/O2_External_WinFormsUI/O2Environment/O2DockPanel.cs:87
> >>  at
> >> O2. 
> >> External.WinFormsUI.O2Environment.O2DockPanel.addControlToO2GuiWithDockPanelSync  
> >> (O2.External.WinFormsUI.O2Environment.O2DockContent controlToAdd)  
> >> [0x00020] in /Users/.../Projects/O2 - All Active Projects/O2  
> >> Modules Using 3rd Party Dlls/O2_External_WinFormsUI/O2Environment/ 
> >> O2DockPanel.cs:99
> >>  at
> >> O2. 
> >> External.WinFormsUI.O2Environment.O2DockPanel.addControlsToFormAndStartIt  
> >> (IEnumerable`1 controlsToAdd) [0x00013] in /Users/.../Projects/O2 -  
> >> All Active Projects/O2 Modules Using 3rd Party Dlls/ 
> >> O2_External_WinFormsUI/O2Environment/O2DockPanel.cs:159
> >>  at
> >> O2. 
> >> External.WinFormsUI.O2Environment.O2DockPanel.openO2DockContentInNewDockPanel  
> >> (System.Collections.Generic.List`1 controlsToLoad) [0x00010] in / 
> >> Users/.../Projects/O2 - All Active Projects/O2 Modules Using 3rd  
> >> Party Dlls/O2_External_WinFormsUI/O2Environment/O2DockPanel.cs:76
> >>  at O2.External.WinFormsUI.O2Environment.O2DockPanel..ctor ()
> >> [0x00006] in /Users/.../Projects/O2 - All Active Projects/O2 Modules
> >> Using 3rd Party
> >> Dlls/O2_External_WinFormsUI/O2Environment/O2DockPanel.cs:20
> >>  at O2.External.WinFormsUI.Forms.O2AscxGUI.<launch>m__8 () [0x00000]
> >> in /Users/.../Projects/O2 - All Active Projects/O2 Modules Using 3rd
> >> Party Dlls/O2_External_WinFormsUI/Forms/O2AscxGUI.cs:43
> >>  at O2.DotNetWrappers.DotNet.O2Thread
> >> +<staThread>c__AnonStorey9.<>m__B () [0x00000]
> >> in /Users/.../Projects/O2 - All Active
> >> Projects/O2Core/O2_DotNetWrappers/DotNet/O2Thread.cs:34
> >> The application was terminated by a signal: SIGHUP
> >>
> >>
> >>
> >>
> >> Thanks
> >>
> >>
> >> Dinis Cruz
> >>
> >> 2010/1/4 Chris Howie <cdhowie at gmail.com>
> >>> I just wrote a blog post about the problem I currently have
> >>>
> >>        (see http://diniscruz.blogspot.com/2010/01/o2-on-mono-monodevelop-and-osx.html 
> >> ),
> >>> which seems to be a variation of one you have seen several
> >>        times in the
> >>> past: "Unhandled Exception: System.DllNotFoundException:
> >>        user32.dll"
> >>
> >>
> >>        This means that your platform is invoking one of Windows'
> >>        native
> >>        libraries.  You need to figure out how to perform the
> >>        equivalent call
> >>        on Linux or OS X.  Note that there may be a framework method
> >>        for what
> >>        you are trying to do, and you should use it if that is the
> >>        case.
> >>
> >>        Without knowing which P/Invoke call you are making it's not
> >>        possible
> >>        to tell if this is fixable.
> >>
> >>        --
> >>        Chris Howie
> >>        http://www.chrishowie.com
> >>        http://en.wikipedia.org/wiki/User:Crazycomputers
> >>
> >>
> >> _______________________________________________
> >> Mono-list maillist  -  Mono-list at lists.ximian.com
> >> http://lists.ximian.com/mailman/listinfo/mono-list
> >



More information about the Mono-list mailing list