Skip to main content
Participant
June 2, 2014

crash at start in _unlock, any ideas?

I've been working on porting some Oculus project from Linux to Windows (32-bit). It includes a connection with a pthread library and some other code.

I used Visual Studio 2012 and a mixture of C and C++. I also recompiled the LibOVR with this compiler (under Debug).

The problem is that my application crashes before it enters the first main, in the following function :
MyApp.exe!OVR::AtomicOpsRaw_4ByteImpl::CompareAndSet_NoSync(volatile long * p, long c, long val) Line 153	C++

The code where it gets an exception is:
void __cdecl _unlock (
int locknum
)
{
/*
* leave the critical section.
*/
LeaveCriticalSection( _locktable[locknum].lock );
}


Any magicians on Windows coding with an idea what's wrong? The original codes works under linux...

    3 replies

    Inspiring
    June 2, 2014
    OK, I have create a bug ticket for this.

    I'll see if someone on the engineering team can take a look.

    Also, can you tell me more about this pthread library? Is it 3rd party code or something you created? Can you think of anything that happens on the start of your app that would trigger this exception?
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    roaltAuthor
    Participant
    June 3, 2014
    The pthreads library I use is found here: http://sourceforge.net/projects/pthreads4w/. I need it as my application makes use of the portaudio library.

    I managed to get things working after changing the Subsystem (from empty/not given) in VS2012 to 'Console':

    <Link>
    <SubSystem>Console</SubSsytem>
    ...
    </Link>


    One of the remaining issues was that the SensorFusion variable was not initialized properly. By doing this not during initialisation but later on (by first defining a SensorFusion pointer and later allocating it) I circumvented the problem.

    It could be that the combination of C and C++ does not work well in my project.
    Inspiring
    June 3, 2014
    Thanks for following up on this.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV