[Gtk-sharp-list] GtkPrint on Windows

Milton Pividori miltondp at gmail.com
Sun Sep 6 11:28:04 EDT 2009


Hi Christian, thank you for your reply. I tried with a simpler example,
but I got the same exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.EntryPointNotFoundException: gtk_enumerate_printers
  at (wrapper managed-to-native) Gtk.Printer:gtk_enumerate_printers (GtkSharp.Pr interFuncNative,intptr,GLib.DestroyNotify,bool)
  at Gtk.Printer.EnumeratePrinters (Gtk.PrinterFunc func, Boolean wait) [0x00000 ]
  at MainWindow.OnButtonClicked (System.Object sender, System.EventArgs e) [0x00 000]
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (ob ject,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] par ameters) [0x00000]
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000]
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000]

  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000]
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args ) [0x00000]
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000]
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000]
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at OtraPruebaGtkPrint.MainClass.Main(System.String[] args)

It doesn't seem to be a recursion issue. The same code works on Linux,
but fails on Windows. This is the code I wrote:

<code>
...
public bool WritePrinterName(Gtk.Printer printer)
{
	Console.WriteLine(printer.Name);
	return false;
}

protected virtual void OnEnumeratePrinters (object sender, System.EventArgs e)
{
	Gtk.Printer.EnumeratePrinters(this.WritePrinterName, false);
}
...
</code>

You can download the complete solution from here:

http://svn.miltonpividori.com.ar/GtkPrintTest.tar.gz

I tried changing the bool parameter in Gtk.Printer.EnumeratePrinters
function, but it doesn't work either.

Any ideas?

El dom, 06-09-2009 a las 12:02 +0200, Christian Hoff escribió:
> Looking into the stack trace, the problem seems that your code is 
> infinetly recurse:
> 
> SolapaServicioImpresion..ctor -> calls EnumeratePrinters -> calls 
> solapaServicioImpresion..ctor-> calls EnumeratePrinters -> ....
> 
> You can also see that gtk_enumerate_printers was already called
> earlier. 
> No idea why you get the EntryPointNotFoundException, but I suspect it
> to 
> be related  to the recursion issue. This is for sure not a problem in
> Gtk#.
> 
> 
> Christian
-- 
Milton Pividori
Blog: http://www.miltonpividori.com.ar
Jabber ID: miltondp at gmail.com
GnuPG Public Key: gpg --keyserver subkeys.pgp.net --recv-key 0x663C185C



More information about the Gtk-sharp-list mailing list