Building Nuitrack into a DLL

I’m trying to build Nuitrack into a DLL that can be consumed by Unity as well as other C# .Net 4.x applications. When I set the platform target to x86, everything works as expected like the demo application and I can get updates. When I change the DLL platform target to Any CPU, the application crashes at Nuitrack.Init(); Is there a that is compiled for Any CPU or x64, or is there only the 32-bit version that comes with the SDK? Otherwise, how does one circumvent this particular issue?

The library is provided as is by nuitrack. In reality the .net implementation is just a set of wrapper code around the native nuitrack.dll runtime library - as such it may be this that is causing the issues inside managed code.

Im not currently aware of a solution to your specific issue around this.

Also … just a heads up - if you build nuitrack into any other DLL - you will still need to distribute the nuitrack dll with each application that runs your DLL - and furthermore - each computer running your application will still also require its own nuitrack licence - and a full installation of the Nuitrack runtime.


Thanks for the response Westa!

So, really, it would come down to either writing my own wrapper around the C++ library or, writing a service that would call run the x86 version and then call into the service.

I was aware of the licensing requirements and the need to distribute the nuitrack dll with the applications, but I appreciate the heads-up on that.

Any Nuitrack official response on this? Could you create a different version of the C# wrapper that would work on an x64 platform?


There should be a way for nuitrack to distribute an x64 or ANY_CPU - but i do suspect it is tied to compatibility questions with the runtime.dll

FWIW its not just the DLL - but the whole nuitrack runtime library that needs to be distributed …
openni installer
activation tool
nuitrack folders
oh and that annoying PATH and ENVIRONMENT variable needs to be set correctly :frowning:


I have the whole installation process of the Nuitrack and OpenNi stuff, including the environment variables in an installer package. My first task in this project was to get Nuitrack running with the existing code base, which was an x86 project, and only needed the skeletal tracking, which is why I didn’t see either of the issues I’ve started posting about before.

I, like you, think that Nuitrack should be able to provide an x64 or Any CPU, but if they can’t, I’ll have to go one of the aforementioned routes. I’m crossing my fingers that they can just flip the compiler switch, click the compile button, and provide it.

If you are interested in getting a heads up on the way the .net wrapper for nuitrack … you didnt hear this from me … but

Have a look at the JetBrains DotPeek program (google it) - it will basically let you unpack the bytecode to the original sourcecode structure of most managed .net libraries - you get no comments or notes - but you do get pretty clean c# code to at least get a better understanding of whats going on in a runtime thats being problematic.


To possibly help other developers, the is compiled for Any CPU. You just have to use the x64 OpenNI and the 64 bit Nuitrack libraries.

I started looking at the Unity example that Nuitrack provides and it uses the same dll that you use otherwise for .Net applications, and I know from reading other posts in this forum that they say that to use the Unity example that you need to install the x64 OpenNi package and the 64 bit version of the Nuitrack libraries. After seeing what they did, and finding the meta file in the unity example indicating it was set for Any CPU, and having the x64 stuff installed, I now have nuitrack running out of my custom dll within Unity.