Page 1 of 1

Problem with calling from Unity

Posted: Mon Sep 12, 2011 4:18 pm
by cybie
I am trying to call Camera SDK from Unity.

However, when I called a DLL function it die trying to create the single CameraManager::X()

In singleton.h

Code: Select all

        static T& X()
        {
            if (m_instance == 0) 
            {
                if(m_Lock==0)
                    m_Lock = new LockItem();

                m_Lock->Lock();
                if(m_instance==0)
                {
                    m_instance = new T; // << Die here
                }
                m_Lock->UnLock();
            }

            return *m_instance;
        };
The "new T" was successful in allocating memory, but failed to continue to go to next line. So I suspect it might be dying in the constructor.

Any Ideas?

Thanks
David

Re: Problem with calling from Unity

Posted: Mon Sep 12, 2011 5:04 pm
by beckdo
I'm not entirely sure what the issue is here but would love to know the answer.

For the Camera SDK the run-time is statically linked. Perhaps that is the problem. If anyone has any additional insight, I would like to track this down so that our Camera SDK will place nice with Unity.

Re: Problem with calling from Unity

Posted: Mon Sep 12, 2011 5:11 pm
by cybie
Hi Doug,

I am not sure if that is the problem, but is it possible for you to release the Camera SDK as dynamically linked DLL?

Thanks
David

Re: Problem with calling from Unity

Posted: Tue Sep 13, 2011 9:58 am
by beckdo
Email support and I'll have them send you a dynamically linked DLL, hopefully that will solve the problem. I will likely add this build to the installer so it's available to everyone.

Re: Problem with calling from Unity

Posted: Tue Sep 13, 2011 4:45 pm
by cybie
Hi Doug,

I have contacted the support through the support contact form. I am still waiting for the library.

Thanks
David

Re: Problem with calling from Unity

Posted: Thu Sep 15, 2011 3:37 pm
by NaturalPoint - Mike
A link to the library should be in your mail.

Re: Problem with calling from Unity

Posted: Fri Oct 21, 2011 1:44 am
by sebh
Hello! I have the same problem here!

I have created a dll I want to call from another program but it dies at singleton creation.
The weird thing is that it works sometimes if I put a printf instruction before creating the singleton. Unfortunately, this is not an acceptable solution.

Have you found any solution? Can I also have an access to that dll please?