SFML community forums

Bindings - other languages => DotNet => Topic started by: Shammah on September 17, 2013, 10:32:38 pm

Title: DllNotFoundException even with .config DllMap
Post by: Shammah on September 17, 2013, 10:32:38 pm
For my project I have three DLLs:


I am using Linux however, so I have to map the correct DLLs using .dll.config files:


Now the contents of sfmlnet-graphics-2.dll.config are the following:

 <configuration>
    <dllmap os="linux" dll="csfml-graphics-2" target="libcsfml-graphics.so.2" />
 </configuration>

This goes all fine and dandy. However, when I try to access particular window functions, like RenderWindow.Close(), I'm getting the following error:

Unhandled Exception:
System.DllNotFoundException: csfml-window-2
  at (wrapper managed-to-native) SFML.Graphics.Context:sfContext_create ()
  at SFML.Graphics.Context..ctor () [0x00000] in <filename unknown>:0
  at SFML.Graphics.Context.get_Global () [0x00000] in <filename unknown>:0
  at SFML.Graphics.Font.Destroy (Boolean disposing) [0x00000] in <filename unknown>:0
  at SFML.ObjectBase.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
  at SFML.ObjectBase.Finalize () [0x00000] in <filename unknown>:0
 

While in fact, I do have sfmlnet-window-2.dll.config with the following contents:

 <configuration>
    <dllmap os="linux" dll="csfml-window-2" target="libcsfml-window.so.2" />
 </configuration>

I have checked the existence of the SO file, and it's there. It's strange situation, because the graphics library gets loaded fine, but somehow the window config does not get loaded (I think), as it's not even changing the dll to the target. I also made sure all DLLs are added as a reference in the project, so that can't be it...
Title: Re: DllNotFoundException even with .config DllMap
Post by: zsbzsb on September 18, 2013, 12:10:39 am
Disclaimer: I develop on Windows only so I am only guessing here.

Quote
dll="csfml-graphics-2"

What about adding a ".dll" to the end so it looks like

Quote
dll="csfml-graphics-2.dll"

And

Quote
I have checked the existence of the SO file, and it's there.

Where are your *.SO files located? I believe in linux they must be in the lib folder and not next to the executable.

Quote
. I also made sure all DLLs are added as a reference in the project, so that can't be it...

There is 4 files you need. The 2 managed dlls that will still end with "*.DLL" and the 2 unmanaged files that will end with "*.SO". You need to add references to the managed dlls and then remap the managed dlls to access the unmanaged *.SO files (located in the lib folder).
Title: Re: DllNotFoundException even with .config DllMap
Post by: Shammah on September 19, 2013, 08:32:41 pm
Appending .dll to the end of the dll="csfml-window-2" did no good, because, as the exception says, it's looking for the file without an extension.

The thing is, everything is working fine for csfml-graphics-2, and this 'carbon config copy' of windows is not. As again, it's not related to being able to find the DLL and SO files as they can clearly be found for the graphics. The problem lies in the fact that the DllMap for windows does not work. Even though I've stated in sfmlnet-window-2.dll.config that <dll="csfml-graphics-2" target="libcsfml-graphics.so.2" />, it still is looking for csfml-graphics-2 and completely ignoring my mapping.
Title: Re: DllNotFoundException even with .config DllMap
Post by: Dominator on September 20, 2013, 11:34:03 pm
Try adding a line for csfml-window-2 in your sfmlnet-graphics-2.dll.config so it looks like this:

Quote
<configuration>
      <dllmap os="linux" dll="csfml-graphics-2" target="libcsfml-graphics.so.2" />
      <dllmap os="linux" dll="csfml-window-2" target="libcsfml-window.so.2" />
</configuration>

I had a similar problem and that fixed it for me.
Title: Re: DllNotFoundException even with .config DllMap
Post by: Shammah on September 22, 2013, 09:58:30 pm
Ah yes, that did the trick! Thanks a lot! ;D
Title: Re: DllNotFoundException even with .config DllMap
Post by: zsbzsb on September 23, 2013, 02:22:37 am
I'm glad that worked, I will remember this for the future in case other people have this problem.  :)