Jump to content
  • Advertisement
Sign in to follow this  
bronxbomber92

[.net] Dll exception with P/Invoke

This topic is 3963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to create a C# interface to SOIL, and I've got all the code written, but I can't get the application to actually find the libSOIL.a library file. I'm on Mac OS X, using this nant build file
<?xml version="1.0"?>
<project name="Game" default="package">
    
    <target name="clean">
        <delete file="Game.exe" />
        <delete dir="Game.app" />
    </target>
    
    <target name="build" depends="clean">
        <csc target="exe" output="Game.exe">
            <sources>
                <include name="Source/*.cs" />
            </sources>
            <references>
                <include name="Assemblies/*.dll" />
                <include name="System.dll" />
                <include name="System.IO.dll" />
                <include name="System.Text.dll" />
                <include name="System.Runtime.InteropServices.dll" />
            </references>
        </csc>
    </target>
    <target name="package" depends="build">
        
        <exec program="macpack">
            <arg value="-m:cocoa" />
            <arg value="-n:Game" />
            <arg value="-a:Game.exe" />
        </exec>
        
        <copy todir="Game.app/Contents/Resources" flatten="true">
            <fileset>
                <include name="Assemblies/*.dll" />
				<include name="Assemblies/*.a" />
                <include name="Assemblies/*.config" />
				<include name="Data/*.png" />
            </fileset>
        </copy>
        
        <exec program="cp">
            <arg value="-r" />
            <arg value="Frameworks" />
            <arg value="Game.app/Contents" />
        </exec>
        
        <exec program="cp">
            <arg value="-r" />
            <arg value="Libraries" />
            <arg value="Game.app/Contents" />
        </exec>
        <delete file="Game.exe" />
    </target>
</project>
but I must admit, I'm not very familiar with nant or any type of C# build process. How can I get my application to find libSOIL.a at runtime? I tried adding libSOIL.a to the Assemblies folder, which in turn is dumped into the Resources folder of the built Mac application, but that doesn't work.

Share this post


Link to post
Share on other sites
Advertisement
Oh. I've never used C# on a Mac, I don't know how well P/Invoke will work, if at all.

I assume you are using Mono, so I did a search on Google and came up with this, which looks like it confirms that dylib's will work with P/Invoke. Give it a shot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!