Skip to content

Conversation

@twhitehead
Copy link
Contributor

@twhitehead twhitehead commented Jun 5, 2025

The VRClientCoreFactory function is declared in the OpenVR SDK without a calling convention. According to Microsoft cdecl is the default calling convention for C and C++ functions, so this means that the user side needs VRClientCoreFactory to be cdecl and not stdcall. This only affects x86 as the compiler ignores stdcall and cdecl when compiling for x64 mode. Without this the calling VR_Init from x86 code crashes.

Also switched the spec file to be cdecl to get rid of some longstanding linker warnings. Presumably it didn't matter that these were wrong as VRClientCoreFactory is only called by the OpenVR SDK VR_Init, which manually loads the library, performing an explicit symbol lookup, and calls through a cdecl function pointer.

…ll."

This reverts commit 454533f.

This had no effect on x64 as stdcall and cdecl are both ignored by
the compiler. On x86 it was caused a crash due to the OpenVR SDK
implicitly declaring the factory function as cdecl (the default).

Closes issue ValveSoftware#8749.
Resolves the following linker warnings

ld: warning: resolving _HmdSystemFactory@8 by linking to _HmdSystemFactory
ld: warning: resolving _VRClientCoreFactory@8 by linking to _VRClientCoreFactory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant