Skip to content

Error PInvokeStackImbalance in runtime #415

Closed Answered by AaronRobinsonMSFT
mknezevic asked this question in Q&A
Discussion options

You must be logged in to vote

My guess is this is an issue only for x86 due to incorrect calling convention.

delegate void Set_JNI_GetDefaultJavaVMInitArgsDelegate(JNI_GetDefaultJavaVMInitArgsDelegate func);

If so, the solution is to adorn the delegate with UnmanagedFunctionPointerAttribute.

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void Set_JNI_GetDefaultJavaVMInitArgsDelegate(JNI_GetDefaultJavaVMInitArgsDelegate func);

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@mknezevic
Comment options

@AaronRobinsonMSFT
Comment options

Answer selected by wasabii
@wasabii
Comment options

@wasabii
Comment options

@wasabii
Comment options

@wasabii
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants