Menu

#7 Delphi Binding

open
spadix
None
5
2010-06-17
2010-05-27
Anonymous
No

Attached is Delphi codes to bind ZBar dll. Please add to Language section

Discussion

  • Anonymous

    Anonymous - 2010-05-27

    你好,我来自中国,我需要你的帮助!
    Hello, I come from China, I need your help!

     

    Last edit: Anonymous 2016-06-22
  • spadix

    spadix - 2010-06-02

    I have a few review comments that need to be addressed before I include this:

    * Is this your original work that you're releasing under the LGPL?

    * For consistency with other interfaces, the initial-cap prefix of the library should be "ZBar", not "Zbar"

    * What is the purpose of the ZBAR_BARCODES array? What additional functionality is introduced over zbar_get_symbol_name? This list should at least be populated using zbar_get_symbol_name, to avoid introducing inconsistencies.

    * The ZBarBarcode procedure is too tightly integrated with application specifics to be included with the library. I suggest splitting out the reusable functionality and removing the monolithic API. eg, a function to read a TIFF file and return a ZBarImage would be a useful addition.

    There are also a few areas I would like to see enhanced, if not now, then in a future patch:

    * I am unable to compile these bindings with FPC - is this expected? I am loathe to unnecessarily require a specific proprietary compiler (note that FPC did compile after some quick hacking...)

    * These bindings introduce Windows specific calls, unnecessarily tying the cross-platform library to a specific platform. A few compiler directives should fix this.

    * The ZBar library uses an object oriented design. Given the availability of object oriented Pascal, it would make sense if the OOP layer was also ported

    * It would be nice if we had a basic test case to verify that the compiled unit is functional

    Thanks for contributing this!

     
  • spadix

    spadix - 2010-06-02
    • assigned_to: nobody --> spadix
    • status: open --> pending
     
  • franky

    franky - 2010-06-09

    I have a working example, although I had to modify the code a bit
    (basically, I don't have the DLL96V1, DLLSP96 the author put in the uses clause, so I've had to remove the following methods from the unit:

    function zbar_image_scanner_parse_config
    function zbar_decoder_parse_config
    procedure ZbarBarcode

    )
    But it stil has a problem I couldn't solve: I get an access violation error when destroying the image in the function 'zbar_image_free_data'

    Here is the code, compiled in Borland Delphi 7 Studio and ready to run. Hope it serves you well: http://www.mediafire.com/?addn2zzydmj
    If by any chance you find why I get the access violation error, please, let me know.

     
    • DimensionSlider

      DimensionSlider - 2016-04-25

      DLL96V1, DLLSP96 come from ImageLib Corporate Suite. Just get the lib.

       
  • franky

    franky - 2010-06-10

    All right, problem solved, I did not set the cleanup function in the zbar_image_set_data, I freed the data from the stream object instead.

    I still get a minor memory leak when reading QR codes(as far as I know, there are no leaks with EAN-13 or with no code at all), and i'm almost sure it's a bug in the library.

    Here's the code:
    http://www.mediafire.com/?zdva4zowmzl
    same as below, but better :D

     
  • spadix

    spadix - 2010-06-10

    Thanks c4pu110. I have not yet been able to run your example, I will try again later.

    btw- do you have the experience to update the bindings as described below so I can include this in the library? If I have to make the changes myself, it's going to be awhile before I can get to it...

    > memory leak when reading QR codes

    This bug is fixed in hg (rev a27e17b2bdd3). Fix should be available with the next release

     
  • Nobody/Anonymous

    I'll give it a try, but I can't promise anything (less than 3 months of experience with Delphi, and mainly as a bugfixer).
    btw, these libraries are better than the commercial stuff I've tried until now, good work!

     
  • SourceForge Robot

    • status: pending --> closed
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • spadix

    spadix - 2010-06-17
    • status: closed --> open
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.