Skip to Content
author's profile photo Former Member
Former Member

Error 15 on External Function Call

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jan 24, 2014 at 03:35 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 24, 2014 at 03:39 PM

    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"

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2014 at 03:45 PM

    Did you compile you Dll with the calling Convention _stdcall :


    Compile.PNG (39.0 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2014 at 03:51 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.