Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Linux shared object with Delphi - DPLUnlockKey
  FAQ FAQ  Forum Search   Register Register  Login Login

Linux shared object with Delphi - DPLUnlockKey

 Post Reply Post Reply
Author
Message
Coogara View Drop Down
Beginner
Beginner


Joined: 06 Jan 19
Location: Australia
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Coogara Quote  Post ReplyReply Direct Link To This Post Topic: Linux shared object with Delphi - DPLUnlockKey
    Posted: 24 Apr 19 at 2:46AM
I'm having trouble getting going with calling a shared object from Delphi on Linux for the DPLUnlockKey method. Granted it could be the license key, but it was obtained today with our purchase of the Linux license. Maybe someone could compare with what they're doing on Linux.

I'm loading my library dynamically with LoadLibrary, after which I GetProcAddress. So far (error checking omitted):

type
  TDPLCreateLibrary = function: integer; stdcall;
  TDPLReleaseLibrary = procedure (InstanceID: integer); stdcall;
  TDPLUnlockKey = function (InstanceID: integer; LicenseKey: PWideChar): integer; stdcall;

var
  DPLCreateLibrary: TDPLCreateLibrary;
  DPLReleaseLibrary: TDPLReleaseLibrary;
  DPLUnlockKey: TDPLUnlockKey;
...
  LibHandle := LoadLibrary('libQPLLinux1612-x86_64.so');

  @DPLCreateLibrary := GetProcAddress(LibHandle, 'DPLCreateLibrary');
  @DPLReleaseLibrary := GetProcAddress(LibHandle, 'DPLReleaseLibrary');
  @DPLUnlockKey := GetProcAddress(LibHandle, 'DPLUnlockKey');

  InstanceID := DPLCreateLibrary;
  writeln('InstanceID: ', InstanceID);
  R := DPLUnlockKey(InstanceID, pchar(DEBENU_PDF_KEY));
...
Lirbary loads okay. InstanceID is non-zero. R (returned by DPLUnlockKey) is always 0. I've tried various syntax on the method type declaration with no success. Thoughts? Any ideas?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 24 Apr 19 at 11:06AM
Hi Coogar,

the unlock-function needs a wide char entry for the key-value - perhaps that's the problem?
https://www.debenu.com/docs/pdf_library_reference/UnlockKey.php
If that's not the problem then perhaps your license key isn't valid anymore (30 days)?

I think you didn't find the official publisher pages for the first steps?
Here they are:
https://www.debenu.com/products/development/debenu-pdf-library/getting-started/
and here:
https://www.debenu.com/products/development/debenu-pdf-library/help/samples/

Cheers and welcome here,
Ingo

Cheers,
Ingo

Back to Top
Coogara View Drop Down
Beginner
Beginner


Joined: 06 Jan 19
Location: Australia
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Coogara Quote  Post ReplyReply Direct Link To This Post Posted: 24 Apr 19 at 7:30PM
Thanks for the links. I had, in fact, seen the sample code you mention but had not made any headway with them for the Delphi/Linux combination using WideString.

As I could not get this to work with a wide string, I opted to change the declaration of the method to use AnsiString, and reference the ANSI version of the method:

  TDPLUnlockKey = function (InstanceID: integer; LicenseKey: AnsiString): integer; stdcall;
...
  @DPLUnlockKey := GetProcAddress(LibHandle, 'DPLUnlockKeyA');
...
  r := DPLUnlockKey(InstanceID, AnsiString(DEBENU_PDF_KEY));

The DPLUnlockKey now returns 1 instead of zero. I will make further attempts to get this to work with a wide string.


Edited by Coogara - 24 Apr 19 at 7:38PM
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store