in

Support Portal

Problems with using SwiftDecode functions bound using GetProcAddress

Last post 05-22-2008 1:50 PM by Adam. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-22-2008 10:48 AM

    • Adam
    • Top 10 Contributor
    • Joined on 05-22-2008
    • Pharmacode
    • Points 35

    Problems with using SwiftDecode functions bound using GetProcAddress

    I'm running into a runtime check failure when I attempt to use functions that have been mapped to the functions in the SD2.dll.  It seems like this only happens when using a function that contains 1 or more parameters, so SD_Create is returning a valid handle, but as soon as I attempt to call SD_Destroy or SD_Set, this error appears.  The specific error is:

    Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
     
    Filed under: ,
    • Post Points: 4
  • 05-22-2008 11:42 AM In reply to

    • Ben Hejl
    • Top 10 Contributor
    • Joined on 05-11-2007
    • Cherry Hill, New Jersey
    • Code 39
    • Points 204

    Re: Problems with using SwiftDecode functions bound using GetProcAddress

    How have you declared the function pointers that are being returned by GetProcAddress?  The functions are exported from the SD2.dll using the __stdcall calling convention.  If the function parameters are declared using a different calling convention, there is a good chance that you will receive this error.

    Filed under:
    • Post Points: 4
  • 05-22-2008 1:50 PM In reply to

    • Adam
    • Top 10 Contributor
    • Joined on 05-22-2008
    • Pharmacode
    • Points 35

    Re: Problems with using SwiftDecode functions bound using GetProcAddress

    Thanks that was exactly what I was missing, I just changed my function pointer from:

     int (*OPWrapper::SD_Destroy)(int Handle) = NULL;

    to

    int (__stdcall *OPWrapper::SD_Destroy)(int Handle) = NULL;

    and now all the function calls appear to be working perfectly. 
    Filed under:
    • Post Points: 1
Page 1 of 1 (3 items)
Copyright Omniplanar, Inc. 2007
Powered by Community Server (Commercial Edition), by Telligent Systems