Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Can I use a Windows DLL in a script written on a mac

Discussion in 'Scripting' started by adxba, Jul 10, 2014.

  1. adxba

    adxba

    Joined:
    Jul 10, 2014
    Posts:
    4
    Hi there,

    Looking at the documentation on plugins here, it looks like I can import DLLs into my code and expose their public methods as with standard C#.

    I've been approached for a project that would involve controlling the outputs an I/O board from within a Unity application, however the application is going to be developed on a mac. I have done this before for this exact board, but it was for a standard Windows .NET application so I know the DLL is good.

    The I/O board comes with an SDK DLL (manual for this can be found at http://www.velleman.eu/downloads/0/user/usermanual_k8055_dll_uk.pdf).

    I was just wandering if and how this will work, surely I can't load a Windows DLL onto a MAC? Or does Mono deal with this (I previously thought this was not possible with Mono outside of Windows)?

    I can't test this myself as I don't yet have a Pro version of Unity (which I believe is required), and just want to confirm to the client that this is even possible before I go ahead and purchase.

    I hope that makes sense, and thanks in advance!
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    Why not? That would be an horrible pain in the ass for plugin maker to have to compile them for different platform.

    Sure, if the DLL pull on platform specific stuff, it will crash on Mac, like accessing System.Drawing. If it doesn't, it should work just fine.
     
    IvanAuda likes this.
  3. adxba

    adxba

    Joined:
    Jul 10, 2014
    Posts:
    4
    It's a third party DLL for a PCB to control outputs so I doubt it's doing anything fancy OS-side except accessing a USB device.

    Thanks :)
     
  4. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    Huh-oh...
     
    IvanAuda likes this.
  5. adxba

    adxba

    Joined:
    Jul 10, 2014
    Posts:
    4
    Is that "uh oh" as in problem or "Huh-oh" as in "oh is that all"? :p
     
  6. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    Huh-oh as it might be a problem. Accessing hardware drivers surely fall into that "OS specific" things. Try it... but if it fails on the USB part, that wouldn't be a surprise.
     
    IvanAuda likes this.
  7. adxba

    adxba

    Joined:
    Jul 10, 2014
    Posts:
    4
    Right. Hmmm. Thanks for your help!