On Tue, 23 Jun 2015 12:07:05 +0000, Mark Morgan Lloyd <[email protected]> wrote:
>Bo Berglund wrote: >> On Mon, 22 Jun 2015 16:43:31 -0300, luiz americo pereira camara >> <[email protected]> wrote: >> >>> In the breakpoint do a step into (f7) and ser the exact line that crashes >>> >>> Luiz >> >> In the pas unit this is the exact line that crashes: >> >> returnVal := RNBOsproFormatPacket (ApiPacket, RB_SPRO_APIPACKET_SIZE); >> >> This is the first call into the drive via the converted obj file. >> Must be something in error in the conversion. > >Or in the declaration of the parameter types. > Note that what I am trying to accomplish is porting an application from Delphi to Lazarus where the dongle handling is by way of an interface unit (spromeps.pas) and an include file (spromeps.obj) where the implementation of the API into the SuperPro driver is done. In Delphi the obj file is used as follows: implementation {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } It has worked just fine since roundabout 2002 in all the Delphi versions we have used including XE5. The spromeps.pas file declares all the needed functions which we need to use in the driver and calls them as externals via the obj file. Unfortunately Lazarus/FPC does not handle the obj file so this thread is really about ways to get around that by converting the obj file to coff (or elf) that FPC can handle. I got tipped off about a tool thta can do this and downloaded objconf from here: http://www.agner.org/optimize/#objconv The problem is most likely in the conversion because even the smallest test application throws an exception on the very first call into the driver, the initialization of the Api data interface array. The function call shown above is the last in a chain starting in the main application by the method Dongle.InitKey. Everything up to this call seems OK on inspection but the actual call to the driver via the converted obj file (now a coff file) fails. Since the obj file works in Delphi with such disparate versions as Delphi 5 up to Delphi XE5 it cannot be a compiler incompatibility problem, really. It MUST be the conversion using objconv, which is somehow improperly set up for the task. But it is hard to understand how to set it up since I have no experience in such low-level programming in Windows. This is where I am now: No matter what I try there are exceptions generated... :( It would have been nice if FPC could accept linking with a regular OBJ file so I did not have to convert it. -- Bo Berglund Developer in Sweden -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
