I'm looking for a freelancer with deep knowledge of the C and Pascal who is able to find the bug in the existing delphi code or make a new dll (wrapper) from the working C code. The delphi code produce Access violation error in the used DLL so the problem lies deep inside the code maybe caused by the different style of memory management or external call method of C and Pascal.
The debugging is difficult because the software runs only on a special hardware (Nikon D800 DSLR) so the freelancer not able to run the code by himself he has to find the problem with analyse the source code or suggest testing method what I can execute. The price is fix 30 USD and I can pay only if the code runs flawlessly without any error.
The Delphi code has two bugs:
1. The Command_CapGetArray function makes Access Violation instantly inside in the Nikon DLL.
(all the other similar functions work well)
2. Running the program without any activity for a few hours makes Access Violation too (one of the DLL functions (Command_Async) called by the main program twice in every second)
I tried to fix this bug in the last three weeks without success. I can debug and compare the delphi and the C code step by step but everything seems the same except the Acc.V. in the delphi exe.
Another solution would be a new wrapper DLL which contains the most important C routines. (function.c, see the file attached). I need the working DLL and the C++ Builder project source to make further changes in it if necessary.
The original project was this:
There is a Nikon SDK ([url removed, login to view]) written in (Visual) C and I need to use it from delphi. The function.c, callback.c, maid3.h, maid3d1.h, NkTypes.h contain all the necessary functions. These files use the [url removed, login to view] and [url removed, login to view] dlls. So I need one or two delphi units which contain all the functions and work with the dlls.
The second bug has gone. Maybe it was related the other part of the code.
I've made the wrapper dll in borland c++ but the first bug is still there.
The original DLL has only one function, an entry point which has several parameters to serve the different functions.
LPNkMAIDObject pObject, // module, source, item, or data object
ULONG ulCommand, // Command, one of eNkMAIDCommand
ULONG ulParam, // parameter for the command
ULONG ulDataType, // Data type, one of eNkMAIDDataType
NKPARAM data, // Pointer or long integer
LPNKFUNC pfnComplete, // Completion function, may be NULL
NKREF refComplete ) // Value passed to pfnComplete
The second parameter could be 12 different kind makes 12 different command (e.g open, close, abort, getcapability, setcapability, etc.)
The problematic command is GetCapabilityArray (GCA) which moves the most memory (data).
There are the cases:
C program -> original DLL : everything is OK
Delphi program calling GCA command -> original DLL: Access violation error in the DLL
Delphi program calling any other commands -> original DLL: OK
Delphi program calling CGA -> wrapper DLL calling CGA -> original DLL: same error
Delphi program calling a function -> wrapper DLL (any function which calls CGA) ->orig DLL: same error
Delphi program calling a function -> wrapper DLL (any function which NOT calls CGA) ->OK