Search code examples
copenedgeprogress-4gldynamic-library

Could not find the entrypoint _pcre2_compile@40. (3260)


I have built a libpcre2-8.dll with the help of this Git Repo.

I'm now trying to access the function pcre2_compile from an ABL (Progress) program. (Progress is an old 4GL Language). I'm constantly hitting the error

Could not find the entrypoint _pcre2_compile@40. (3260)

I've already tried many things but it still doesn't work.

The Dynamic Library is 64 bit and Progress is also running in 64 bit.

In ABL (Progress) you can specify the LIBRARY-CALLING-CONVENTION but whether I set it to STDCALL or CDECL or just don't specify it, the error remains the same.

This is a snippet of the Progress ABL I'm trying to execute the function: (code comes from this Git Repo, which works, but only for 32 bit)

PROCEDURE pcre2_compile :
    DEFINE INPUT               PARAMETER pattern     AS CHARACTER. /* const char *          */
    DEFINE INPUT               PARAMETER options     AS INTEGER.   /* int                   */
    DEFINE       OUTPUT        PARAMETER errcodeptr  AS INTEGER.   /* int *                 */
    DEFINE       OUTPUT        PARAMETER errptr      AS MEMPTR.    /* const char **         */
    DEFINE       OUTPUT        PARAMETER erroffset   AS MEMPTR.    /* int *                 */
    DEFINE INPUT               PARAMETER tableptr    AS INTEGER.   /* const unsigned char * */
    DEFINE              OUTPUT PARAMETER result      AS MEMPTR.    /* pcre *                */

    DEFINE VARIABLE libName AS CHARACTER NO-UNDO.
    DEFINE VARIABLE hCall   AS HANDLE    NO-UNDO.

    libName = get-library().

    CREATE CALL hCall.
    ASSIGN
        hCall:CALL-NAME                  = "pcre2_compile"
        hCall:LIBRARY                    = "lib/libpcre2-8.dll"
        //hCall:LIBRARY-CALLING-CONVENTION = "STDCALL"
        hCall:CALL-TYPE                  = DLL-CALL-TYPE
        hCall:NUM-PARAMETERS             = 6
        hCall:RETURN-VALUE-DLL-TYPE      = "MEMPTR".

    hCall:SET-PARAMETER(1, "CHARACTER", "INPUT" , pattern    ).
    hCall:SET-PARAMETER(2, "LONG"     , "INPUT" , options    ).
    hCall:SET-PARAMETER(3, "HANDLE TO LONG"     , "OUTPUT", errcodeptr ).
    hCall:SET-PARAMETER(4, "MEMPTR"   , "OUTPUT", errptr     ).
    hCall:SET-PARAMETER(5, "MEMPTR"   , "OUTPUT", erroffset  ).
    hCall:SET-PARAMETER(6, "LONG"     , "INPUT" , tableptr   ).
    hCall:INVOKE().
    ASSIGN result = hCall:RETURN-VALUE.

    DELETE OBJECT hCall.

END PROCEDURE.

What am I missing?

Update: Checked with Dependency Walker and the functions seem to be visible. They do have a _8 suffix... But even when trying pcre2_compile_8 it still gives me the same error.

enter image description here


Solution

  • So the problem was that the name of the entry point was "pcre2_compile_8" instead of "pcre2_compile"... Wanted to delete the question because now it looks quite dumb but leaving it anyway...