Hello, I'm the main windows developer for Open Transactions:
(don't know about Open Transactions check out my other thread:
https://bitcointalksearch.org/topic/moneychanger-windows-builds-out-of-date-77301)
I need the help of a Windows API .NET CLI/C++ expert.
I have been trying to develop a CLI/C++ interface for the OTAPI (Open Transactions API). To allow any .NET developer easy access in calling OT functions. (Without needing P/Invoke and Swig).
I have got all the code compiling, without warnings. I'm properly doing the __declspec(dllexport) and __declspec(dllimport) (afaict).
However on execution, I'm getting the impossible to debug:
(x64):An unhandled exception of type 'System.AccessViolationException' occurred in ot_clr_prompt.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
(x86):A first chance exception of type 'System.BadImageFormatException' occurred in ot_clr_prompt.exe
Additional information: Could not load file or assembly 'otapicli.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
Need a Windows API Expert to help me with a CLI/C++ interface error.
When debugging the suspect code its:
#if defined (_MANAGED_MAIN)
mainret = main(arguments); <- the exception happens here.
#else /* defined (_MANAGED_MAIN) */
However I'm finding it impossible to debug further.
I'm compiling all the source code with the same mode: Multi-threaded Debug DLL (/MDd) <- I even compile my own versions of ChaiScript, protobuf, and ZMQ, so be certain that they are using the same compiler settings.
All of the DLL's seem to be linked properly, and I have been quite careful about the references.
If anyone (maybe expert), wants to delve into this rabbit hole with me, and help, please checkout:
https://github.com/da2ce7/Open-TransactionsI have full install setup instructions here:
https://github.com/da2ce7/Open-Transactions/blob/master/docs/INSTALL-Windows.txtIn #opentransactions on freenode, I am regularly on-line as 'da2ce7.'
I think that this features, if possible to get stable, will be a big boon for writing a OT GUI for windows.
The suspect code files are:
https://github.com/da2ce7/Open-Transactions/blob/master/project/ot_clr_prompt/ot_clr_prompt.cpp <- my test CLI file
https://github.com/da2ce7/Open-Transactions/blob/master/include/otapi/otapicli.h <- the CLI/C++ interface;
https://github.com/da2ce7/Open-Transactions/blob/master/src/otapi/otapicli.cpp <- the related cpp file.
https://github.com/da2ce7/Open-Transactions/blob/master/include/otapi/OTAPI_Wrapper.h <- the native C++ interface.
However I suppose this bug isn't so-much related to the code itself, but rather the build system.
I'll even chip a few Bitcoins in the way of anyone who can help me solve this issue.
Ok I have worked out the error.
I had a few things compiling as static libraries; while fine if your code is perfect; they hide many linker errors. I changed of the projects in the solution to compile as DLLs, and cleaned up all the linker errors, (and warnings). Bang-Presto. It 'just worked'