Print Page | Close Window

DPLUnlockkey not working with Powerbuilder 8

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2712
Printed Date: 22 Nov 24 at 1:02PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DPLUnlockkey not working with Powerbuilder 8
Posted By: jfields
Subject: DPLUnlockkey not working with Powerbuilder 8
Date Posted: 21 Aug 13 at 3:36AM
Hi all,
 
We have purchased a license and the license works with the vb6 sample code and 9.15 active X object.
 
I am now trying to implement the license in Powerbuilder 8 with the 9.15 dll. 
 
DPLCreateLibrary is returning a nonzero number, so I am assuming that the instance id is good.
 
When I pass the instance id to DPLUnlockkey with our license, DPLUnlockkey returns 0 with no messages.
 
Any ideas what I am doing wrong?  My code is similar to http://www.quickpdf.org/forum/dplloadfromstring-for-powerbuilder_topic2560.html?KW=unlockkey" rel="nofollow - http://www.quickpdf.org/forum/dplloadfromstring-for-powerbuilder_topic2560.html?KW=unlockkey
 
I loaded the Powerbuild import header that was for PB version > 10 and removed the "ALIAS FOR" part for these 2 functions.
 
Any help would be appreciated.
 
Thanks,
-Jean
 



Replies:
Posted By: Wheeley
Date Posted: 21 Aug 13 at 6:06AM
Powerbuilder 8 uses Ansi strings internally. So you need to use the alias for clause for your external function declaration. Unfortunately, Debenu hasn't been keeping up their include file correctly. From the file for 9.15 I see this:

FUNCTION long DPLUnlockKey(long InstanceID, string LicenseKey) LIBRARY "DebenuPDFLibraryDLL0915.dll" ALIAS FOR "DPLUnlockKey;ansi"

But it should be this:

FUNCTION long DPLUnlockKey(long InstanceID, string LicenseKey) LIBRARY "DebenuPDFLibraryDLL0915.dll" ALIAS FOR "DPLUnlockKeyA;ansi"

So, for every function you use you need to append an A character to the function name so you direct Powerbuilder to use the ansi function not the unicode function.

Hope this helps
Wheeley


Posted By: jfields
Date Posted: 04 Sep 13 at 1:49AM

Thanks Wheeley for your reply.

My application is not getting to the DPLUnlockKey function, it is throwing an error at DPLCreateLibrary
 
FUNCTION long DPLCreateLibrary() LIBRARY "DebenuPDFLibraryDLL0915.dll" ALIAS FOR "DPLCreateLibrary;ansi"

When I run my application, I get the following error:
Powerbuilder Application Execution Error (R0015)
Application Terminated
Error: Error calling external function DPLCreateLibrary;ansi at line...

As far as I can tell, the DLL is loading into memory correctly.

Anything else I should check?

Thanks in advance,
-Jean

Edit:  I had tried DPLCreateLibraryA, but used DLLExport to find there was no DPLCreateLibraryA function.


Posted By: Wheeley
Date Posted: 04 Sep 13 at 8:44PM
You only need the ";ansi" when you are passing string arguments. So it should be

FUNCTION long DPLCreateLibrary() LIBRARY "DebenuPDFLibraryDLL0915.dll" ALIAS FOR "DPLCreateLibrary"

OR just

FUNCTION long CreateLibrary() LIBRARY "DebenuPDFLibraryDLL0915.dll" ALIAS FOR "DPLCreateLibrary"

Wheeley


Posted By: jfields
Date Posted: 13 Sep 13 at 8:59PM
Hi all,
 
Just to let everyone know I finally figured it out through trial and error:
 
Here is how I modified the header file:
 
removed all ";ansi" from every line
 
next, I used a DLL Exporter to find all the function names in the DLL 
 
for functions with corresponding "A" functions, for these functions I added the "A" to the ALIAS FOR name in the header
 
for those functions without corresponding "A" functions, I removed the whole ALIAS FOR part
 
Thanks to all that helped.
-Jean


Posted By: AndrewC
Date Posted: 16 Sep 13 at 7:12AM
Jean,

We do not have access here to PowerBuilder 8.  It sounds like version 8 works a little differently to to 9 and 10.  If you can send us your final import file we should be able to include it automatically in future QPL releases.

You can email to to support@debenu.com.

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk