4

I am currently working on a Unity3d 4.0 Pro project where i am trying to link the tngaming vest to unity. The only SDK ( http://tngames.com/pages/Developers ) i have available is a C++ .h and a .lib file. As far as i understand from the documentation ( http://docs.unity3d.com/Documentation/Manual/Plugins.html ), i should simply put the two tngaming.h and tngaming.lib into my assets folder and do the following code:

[DllImport("tngaming")]
private static extern int SetUpJacket();

And that would allow me to call the function SetUpJacket(). However i get the DllNotFoundException: tngaming error.

Anyone who got some information doing something similar who can help out?

4
  • 1
    Is the tngaming.dll in your Unity project's Assets/Plugins folder? When you run the .exe, is the DLL in the same directory as the .exe? Jan 7, 2013 at 14:39
  • As far as i know, there is no dll, just a .h and a .lib file. Secondly initially I'm just trying to get it to work and as such i am not exporting my unity to any exe file at this point. It is not working in the unity work window. Jan 7, 2013 at 17:40
  • I'm not positive, but I think you must use a compiled .dll. Jan 7, 2013 at 18:21
  • @ChrisSinclair That's correct. Also relevant.
    – Jerdak
    Jan 7, 2013 at 20:03

2 Answers 2

2

Thank you all for your assistance.. The actual goal was to find a way to change unmanaged c++ code (.h and .lib file) to a unmanaged .dll and then create a c# wrapper..

It took a lot of very obscure searching but i managed to find a page that did exactly what i needed in a guide form.

http://waterhobo.com/?p=28

At the bottom of the page, there is a link in the line "Here is the source code i made" for those who want to skip the programming parts and just use the TN Gaming Vest in C#.

0

From http://docs.unity3d.com/Documentation/Manual/PluginsForDesktop.html

Once built, the bundle should be placed in the Assets->Plugins folder in the Unity project. Unity will then find it by name.

MacOS libraries are .lib, Windows libraries are .dll, and Linux libraries are .so. The other commenters are incorrect; plugins do not have to be in .dll format. I believe (not sure) that .dll's will work on Mac as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.