SFML community forums

Bindings - other languages => DotNet => Topic started by: s.baus on July 09, 2014, 09:14:26 am

Title: EntryPointNotFoundException on Mono (Linux)
Post by: s.baus on July 09, 2014, 09:14:26 am
Hello,

I'm facing a EntryPointNotFoundException, when trying to run SFML.Net on Mono (Fedora Linux). I have installed the SFML package, have packed the SFML.Net libraries with my application and did a dllconfig:

sfmlnet-audio-2.dll.config:
Quote
<configuration>
   <dllmap dll="csfml-audio-2" target="libsfml-audio.so.2" os="linux"/>
   <dllmap dll="csfml-window-2" target="libsfml-window.so.2" os="linux"/>
   <dllmap dll="csfml-graphics-2" target="libsfml-graphics.so.2" os="linux" />
</configuration>

If I enter the code, where sound should be played, I get this Exception:
Quote
[sven@localhost AudioCuesheetEditor-linux-v1.1.3]$ mono AudioCuesheetEditor.exe
Marshaling clicked signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.EntryPointNotFoundException: sfMusic_createFromFile
  at (wrapper managed-to-native) SFML.Audio.Music:sfMusic_createFromFile (string)
  at SFML.Audio.Music..ctor (System.String filename) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.SFML.CustomMusicSFML..ctor (System.String filePath) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.setMusic () [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.checkAndPlayMusic (TimeSpan offset) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.play () [0x00000] in <filename unknown>:0
  at MainWindow.btnPlayPauseClicked (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0
   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 AudioCuesheetEditor.MainClass.Main(System.String[] args)
Has anybody had this? Am I doing something wrong in the dll config? Thanks for any help.
Title: Re: EntryPointNotFoundException on Mono (Linux)
Post by: zsbzsb on July 09, 2014, 02:10:15 pm
You need to remap to CSFML, not just SFML.
Title: Re: EntryPointNotFoundException on Mono (Linux)
Post by: s.baus on July 10, 2014, 07:59:27 am
You need to remap to CSFML, not just SFML.
Well, I install SFML Package from Fedora provided, and there are no csfml libraries:

If I do the following mapping
Quote
<configuration>
   <dllmap dll="csfml-audio-2" target="libcsfml-audio.so.2" os="linux"/>
   <dllmap dll="csfml-window-2" target="libcsfml-window.so.2" os="linux"/>
   <dllmap dll="csfml-graphics-2" target="libcsfml-graphics.so.2" os="linux" />
</configuration>
I get this exception:
Quote
[sven@localhost AudioCuesheetEditor-linux-v1.1.3]$ mono AudioCuesheetEditor.exe

(AudioCuesheetEditor:1817): GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GdkWindow'

(AudioCuesheetEditor:1817): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
Marshaling clicked signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: libcsfml-audio.so.2
  at (wrapper managed-to-native) SFML.Audio.Music:sfMusic_createFromFile (string)
  at SFML.Audio.Music..ctor (System.String filename) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.SFML.CustomMusicSFML..ctor (System.String filePath) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.setMusic () [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.checkAndPlayMusic (TimeSpan offset) [0x00000] in <filename unknown>:0
  at AudioCuesheetEditor.AudioBackend.AudioManagerSFML.play () [0x00000] in <filename unknown>:0
  at MainWindow.btnPlayPauseClicked (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0
   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 AudioCuesheetEditor.MainClass.Main(System.String[] args)
So I wouldn't say its a mapping problem. Or where is the error?
Title: Re: EntryPointNotFoundException on Mono (Linux)
Post by: zsbzsb on July 10, 2014, 01:09:48 pm
Quote
and there are no csfml libraries

Well, good luck trying to make SFML.NET work without CSFML.

Quote
So I wouldn't say its a mapping problem. Or where is the error?

"System.DllNotFoundException: libcsfml-audio.so.2"
Title: Re: EntryPointNotFoundException on Mono (Linux)
Post by: s.baus on July 11, 2014, 01:02:18 pm
Hello,

thanks for your help. I already installed SFML Package for Fedora provided by Fedora. In the files list, the libraries above are mentioned. They are packaged as the official SFML libraries found here http://sfml-dev.org/download/sfml/2.1/ (http://sfml-dev.org/download/sfml/2.1/). So, why should I map to libcsfml-xxx instead of libsfml-xxx? This makes no sense in my opinion. Could someone please tell my how to do a correct mapping?

Thanks in advance
Sven
Title: Re: EntryPointNotFoundException on Mono (Linux)
Post by: zsbzsb on July 11, 2014, 01:07:21 pm
Because you always need SFML and CSFML, even on windows. SFML is a C++ library which means its exported names are mangled so you need a C interface hence CSFML to allow SFML.NET to work. So build / install CSFML and map to that. There is no other way, so suck it up and listen to me or forget about getting it to work on linux.
Title: Re: EntryPointNotFoundException on Mono (Linux)
Post by: s.baus on July 11, 2014, 02:21:18 pm
Thanks for the friendly answer. I didn't know, that CSFML != SFML and thought SFML == CSFML. But now I know, they aren't the same, downloaded the C binding for SFML and could get SFML.Net to work on Linux. Thank you and have a great weekend ;).