"PInvokeStackImbalance was detected" from HDFDotNet 1.8.7

I have been attempting to update to the latest HDF5DotNet wrappers (1.8.7)
and am getting the following warnings (when running in DEBUG mode from
VS2010):

PInvokeStackImbalance was detected
Message: A call to PInvoke function 'HDF5DotNet!<Module>::H5Fopen' has
unbalanced the stack.
This is likely because the managed PInvoke signature does not match the
unmanaged target signature.
Check that the calling convention and parameters of the PInvoke signature
match the target unmanaged signature.

I am using the pre-compiled binaries (HDF5DotNet assembly for .NET Framework
4.0 32-bit), but got the same result when I compiled from source.

Strangely, when executing my application that calls the HDF5DotNet wrappers
in non-DEBUG mode, I see no problems. I did notice that between 1.8.6 and
1.8.7 all the calling conventions were switched from Cdecl to StdCall.
Could this be causing this?

Thanks!

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/PInvokeStackImbalance-was-detected-from-HDFDotNet-1-8-7-tp2990766p2990766.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Josha, which unmanaged binaries are you using?

G.

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of josha
Sent: Thursday, May 26, 2011 5:15 PM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] "PInvokeStackImbalance was detected" from HDFDotNet
1.8.7

I have been attempting to update to the latest HDF5DotNet wrappers (1.8.7)
and am getting the following warnings (when running in DEBUG mode from
VS2010):

PInvokeStackImbalance was detected
Message: A call to PInvoke function 'HDF5DotNet!<Module>::H5Fopen' has
unbalanced the stack.
This is likely because the managed PInvoke signature does not match the
unmanaged target signature.
Check that the calling convention and parameters of the PInvoke signature
match the target unmanaged signature.

I am using the pre-compiled binaries (HDF5DotNet assembly for .NET Framework
4.0 32-bit), but got the same result when I compiled from source.

Strangely, when executing my application that calls the HDF5DotNet wrappers
in non-DEBUG mode, I see no problems. I did notice that between 1.8.6 and
1.8.7 all the calling conventions were switched from Cdecl to StdCall.
Could this be causing this?

Thanks!

--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/PInvokeStackImbalance-was-detected-fro
m-HDFDotNet-1-8-7-tp2990766p2990766.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

The HDF5DotNet wrapper-library is calling the HDF5 1.8.7 library.

It looks like changing all the calling conventions for the HDF5 library
prototypes in the HDF5DotNet files from
"CallingConvention=CallingConvention::StdCall" to
"CallingConvention=CallingConvention::Cdecl" fixed the problem (at least
made the MDA/PInvokeStackImbalance go away).

I don't know why they were changed from Cdecl originally to StdCall anyway
(as it appears that the HDF5 library expects cdecl). Any ideas?

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/PInvokeStackImbalance-was-detected-from-HDFDotNet-1-8-7-tp2990766p2993001.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Josha, switching the calling conventions is the right thing to do. We'll
update the source and provide new binaries by Monday (5/27).
Note: this is a 32-bit Windows issue, since there is only one calling
convention
in 64-bit Windows.

Thanks for pointing this out!
G.

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of josha
Sent: Friday, May 27, 2011 9:02 AM
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] "PInvokeStackImbalance was detected" from HDFDotNet
1.8.7

The HDF5DotNet wrapper-library is calling the HDF5 1.8.7 library.

It looks like changing all the calling conventions for the HDF5 library
prototypes in the HDF5DotNet files from
"CallingConvention=CallingConvention::StdCall" to
"CallingConvention=CallingConvention::Cdecl" fixed the problem (at least
made the MDA/PInvokeStackImbalance go away).

I don't know why they were changed from Cdecl originally to StdCall anyway
(as it appears that the HDF5 library expects cdecl). Any ideas?

--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/PInvokeStackImbalance-was-detected-fro
m-HDFDotNet-1-8-7-tp2990766p2993001.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

No problem. Thanks for your help!

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/PInvokeStackImbalance-was-detected-from-HDFDotNet-1-8-7-tp2990766p2993156.html
Sent from the hdf-forum mailing list archive at Nabble.com.