Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: DllNotFoundException even with .config DllMap  (Read 5991 times)

0 Members and 1 Guest are viewing this topic.

Shammah

  • Newbie
  • *
  • Posts: 5
    • View Profile
DllNotFoundException even with .config DllMap
« on: September 17, 2013, 10:32:38 pm »
For my project I have three DLLs:

  • sfmlnet-audio-2.dll
  • sfmlnet-graphics-2.dll
  • sfmlnet-window-2.dll

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

  • sfmlnet-audio-2.dll.config
  • sfmlnet-graphics-2.dll.config
  • sfmlnet-window-2.dll.config

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...

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: DllNotFoundException even with .config DllMap
« Reply #1 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).
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Shammah

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: DllNotFoundException even with .config DllMap
« Reply #2 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.

Dominator

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: DllNotFoundException even with .config DllMap
« Reply #3 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.

Shammah

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: DllNotFoundException even with .config DllMap
« Reply #4 on: September 22, 2013, 09:58:30 pm »
Ah yes, that did the trick! Thanks a lot! ;D

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: DllNotFoundException even with .config DllMap
« Reply #5 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.  :)
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor