New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mono crashes #8588
Comments
Can the files be submited differently to github, i.e. w/o a dropbox login? |
The first param of pos_open is [DllImport("libpos.so.1.24.0", EntryPoint = "pos_set", CallingConvention = CallingConvention.Cdecl)]
private extern static ```Boolean Set(ref IntPtr handle_p, string param, string val); has to be replaced by [DllImport("libpos.so.1.24.0", EntryPoint = "pos_set", CallingConvention = CallingConvention.Cdecl)]
private extern static Boolean Set(IntPtr handle_p, string param, string val); (remove the ref attribute) |
I've filled project to git here https://github.com/Rombersoft/pos_terminal |
There is such method on C lang bool pos_get_first(POS_HANDLE handle, char *param, int param_size,
char *val, int val_size); Is right PInvoke? [DllImport("libpos.so.1.24.0", EntryPoint = "pos_get_first", CallingConvention = CallingConvention.Cdecl)]
private extern static Boolean GetFirst(IntPtr handle_p, string param, Int32 paramSize, string val, Int32 valSize); because I get next Error
|
string type suit well for So, if the pointers may be freed by mono, use StringBuilder like this [DllImport("libpos.so.1.24.0", EntryPoint = "pos_get_first", CallingConvention = CallingConvention.Cdecl)]
private extern static Boolean GetFirst(IntPtr handle_p, StringBuilder param, Int32 paramSize, StringBuilder val, Int32 valSize); else, use IntPtr and marshal it to a string. [DllImport("libpos.so.1.24.0", EntryPoint = "pos_get_first", CallingConvention = CallingConvention.Cdecl)]
private extern static Boolean GetFirst(IntPtr handle_p, IntPtr param, Int32 paramSize, IntPtr val, Int32 valSize); Detailed informations on this at: http://www.mono-project.com/docs/advanced/pinvoke/ |
I've already written this article and when I use StringBuilder function does not set it value and stringBuilder.ToString() returns empty string |
SEcond variant with IntPtr is not suitable because IntPtr must has value before using in in function private extern static Boolean GetFirst(IntPtr handle_p, IntPtr param, Int32 paramSize, IntPtr val, Int32 valSize); |
I have C library for working with this pos_terminal https://www.verifone.com/en/us/devices/countertops-pin-pads/vx-520
I use
And my application crashes after second method calling
Steps to Reproduce
Project is here https://www.dropbox.com/s/8l0czx4091y1usj/BugZilla.tar.gz?dl=0
Dependencies and manuals are here https://www.dropbox.com/s/ip59ivgkkaid7st/posapi-centos-x64_1.24.tar.bz2?dl=0
Current Behavior
Expected Behavior
On which platforms did you notice this
[ ] macOS
[*] Linux
[ ] Windows
Version Used:
Debian 9 Stretch
Stacktrace
https://bugzilla.xamarin.com/show_bug.cgi?id=46511
The text was updated successfully, but these errors were encountered: