cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PowerBuilder - Error calling an external function

Former Member
0 Likes
5,705

Hi,

I am trying to call a function located in a DLL that was developed for us. When I try to run the script it is showing me the following error: "Error opening DLL library Encryption.dll for external function at line ....... ".

How I am defining the External functions on PowerBuilder?

Function string EncryptStringAES &
(string plainText, &
string sharedSecret &
) Library "Encryption.dll" Alias For "EncryptStringAES"


Function string DecryptStringAES &
(string cipherText, &
string sharedSecret &
) Library "Encryption.dll" Alias For "DecryptStringAES"

How they are in the DLL ?

The class name is Crypto, and it is in the Encryption namespace.

public static string EncryptStringAES(string plainText, string sharedSecret)

public static string DecryptStringAES(string cipherText, string sharedSecret)

I am using PB 10.2.1 , for now!

Thanks.

View Entire Topic
Former Member
0 Likes

Hi Luis;

If your DLL developer did not create the DLL as per Unicode specifications - as is PB 10.x - you might need to add the following to the external declaration, as follows ....

Function string EncryptStringAES &
(string plainText, &
string sharedSecret &
) Library "Encryption.dll" Alias For "EncryptStringAES;ansi"


Function string DecryptStringAES &
(string cipherText, &
string sharedSecret &
) Library "Encryption.dll" Alias For "DecryptStringAES;ansi"

HTH

Regards ... Chris

Former Member
0 Likes

Chris, thanks for your answer.

The developer is not sure about the Unicode specifications, but as you said I added the ;ansi keyword on both, and I still have the same problem.

Luis.