on 01-24-2014 3:22 PM
Hello,
I have an DLL external function written in C++ compiled with Unicode. I am receiving an error on the function call through PB.....Error number: 15; Error calling external function %s at line 86.... Does Unicode require that the function call be declared differently? The declaration is below.
public SUBROUTINE XY_abcLink (long handle, ref string parameters, ref string result) LIBRARY "XYABC.DLL" ALIAS FOR "XY_abcLink;ansi"
The DLL exists, is named correctly, has no dependencies missing (ran dependencywalker and verified), removed the ansi declaration, verified the parms being passed are correct/valid, etc.
I've read some of the other threads regarding issues with DLL external function calls but have not gathered enough information to track down my issues. Any suggestions would be appreciated.
The second argument is not an array...just a concatenated string of data.
I did allocate memory for the result string being returned but not for the params being passed.
I have removed the ansi suffix on the call and still receive the same error.
I will have to check and see how the DLL was compiled.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you need to remove the ";ANSI" suffix on your call. That's telling PB to make the call as ANSI rather than Unicode:
public SUBROUTINE XY_abcLink (long handle, ref string parameters, ref string result) LIBRARY "XYABC.DLL" ALIAS FOR "XY_abcLink"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Julie,
It would be interesting to post the PowerScript when error happens.
By the way, is the 2nd argument parameters an array of string (becasuse I see an "s" in its name)?
Also, did you use the Space() method for strings passed by reference before calling the external function?
Indeed, PB needs to allocated some spaces for strings.
HTH
Jacob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.