Managed c++ libraries inside Xenko

Hello Xenko team,

We are currently doing a project where a set of external libraries were written that basically read data from a Leap Motion controller and also need to communicate with a special hardware, they are written in native c++

Now we want to use them inside Xenko, a managed c++ wrapper was made. We add it as a reference in the project and in a sync Script we add.

using SiliconStudio.Xenko.Engine;
using MyManageLibrary;


namespace MyGame
{
    public class LoadMyLibrary : SyncScript
    {
        // Declared public member fields and properties will show in the game studio
        private MyObject coordinator;

        public override void Start()
        {
            // Initialization of the script.
            coordinator = new MyObject();
        }

        public override void Update()
        {
            // Do stuff every new frame
        }
    }
}

When we compile MyGame.Game only, there is no errors at all, but when we compile MyGame.Windows compilation fails with this error:

Error: Error while loading assembly reference [D:\projects\Xenko\FastHaptic\FastHaptic\Bin\Windows\Debug\MyLibrary.dll]. Could not load file or assembly 'MyLibrary, Version=1.0.6393.28659, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)

I also get a bunch of warnings about mismatch of between processor architecture of the project “MSIL” and the processor architecture of the reference “MyLibrary”.

Is there something we are missing or do we need to do it in a different way.

Thanks in advance
Oscar Juárez.

1 Like