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

Author Topic: System.DllNotFoundException on Mac OS  (Read 5473 times)

0 Members and 1 Guest are viewing this topic.

rcplusplus

  • Newbie
  • *
  • Posts: 15
    • View Profile
System.DllNotFoundException on Mac OS
« on: August 19, 2019, 06:57:50 am »
I'm on Mac OS Mojave using Visual Studio Community 2019.

First I created a blank C# project. Then I installed the SFML.Net NuGet. After that, this is what my packages.config file looked like:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="CSFML" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Audio" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Graphics" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Net" version="2.5.0" targetFramework="net47" />
  <package id="SFML.System" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Window" version="2.5.0" targetFramework="net47" />
</packages>

I then create a simple main program:

using System;
using SFML;
using SFML.Graphics;
using SFML.Window;

namespace HelloSFML
{
    class MainClass
    {
        private static RenderWindow _window;

        public static void Main(string[] args)
        {
            _window = new RenderWindow(new VideoMode(640, 480), "Hello SFML!");
            _window.SetVisible(true);
            _window.Closed += new EventHandler(OnClosed);
            while (_window.IsOpen)
            {
                _window.DispatchEvents();
                _window.Clear(Color.Black);
                _window.Display();
            }
        }

        private static void OnClosed(object sender, EventArgs e)
        {
            _window.Close();
        }
    }
}

After building, I then copy the following files to my the Debug/bin folder of my project:

libcsfml-audio.2.5.0.dylib
libcsfml-graphics.2.5.0.dylib
libcsfml-network.2.5.0.dylib
libcsfml-system.2.5.0.dylib
libcsfml-window.2.5.0.dylib

I then also create a file called sfmlnet-graphics.dll.config in that same folder with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
        <dllmap dll="csfml-graphics" target="libcsfml-graphics.2.5.0.dylib"/>
        <dllmap dll="csfml-audio" target="libcsfml-audio.2.5.0.dylib"/>
        <dllmap dll="csfml-window" target="libcsfml-window.2.5.0.dylib"/>
        <dllmap dll="csfml-system" target="libcsfml-system.2.5.0.dylib"/>
        <dllmap dll="csfml-network" target="libcsfml-network.2.5.0.dylib"/>
</configuration>

However, when I run the program, I get the following exception:

{System.DllNotFoundException: csfml-graphics
  at (wrapper managed-to-native) SFML.Graphics.RenderWindow.sfRenderWindow_createUnicode(SFML.Window.VideoMode,intptr,SFML.Window.Styles,SFML.Window.ContextSettings&)
  at SFML.Graphics.RenderWindow..ctor (SFML.Window.VideoMode mode, System.String title, SFML.Window.Styles style, SFML.Window.ContextSettings settings) [0x00040] in <e68fba52605f4eee88783890392bddfc>:0
  at SFML.Graphics.RenderWindow..ctor (SFML.Window.VideoMode mode, System.String title) [0x0000b] in <e68fba52605f4eee88783890392bddfc>:0
  at HelloSFML.MainClass.Main (System.String[] args) [0x00001] in /Users/rutvik/Desktop/hello-csharp/hello-csharp/MainClass.cs:14 }

I'm really not sure what other steps are required to get this to work. There are some other posts on this forum:

https://en.sfml-dev.org/forums/index.php?topic=24990.msg166468#msg166468

https://en.sfml-dev.org/forums/index.php?topic=25450.0


^ Both of those posts seem inconclusive and don't fix my problem (from what I can tell). Not sure what other steps are needed to get this to work...
« Last Edit: August 19, 2019, 05:16:49 pm by rcplusplus »

ashley

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: System.DllNotFoundException on Mac OS
« Reply #1 on: September 16, 2019, 01:04:57 am »
Hey - I'm one of the other posters you linked to. Not sure if you've already fixed your issue, but I've followed up on my thread with how I fixed it. Happy to give further info it doesn't help :)

Edit: it looks like we're already using the same packages - huh.

I have ran `brew install csfml sfml` on my system; perhaps that is sufficient? Although not the best fix.
« Last Edit: September 16, 2019, 01:15:19 am by ashley »

 

anything