SQLAllocHandle是如何定义的?

时间:2015-11-07 03:16:50

标签: c++ winapi odbc

ALL,

我有以下代码:

    SQLHENV env;
    typedef SQLRETURN (*SQLALLOCINFO)(SQLSMALLINT, SQLHANDLE, SQLHANDLE *);
    SQLALLOCINFO *sqlAllocInfo = NULL;
    HINSTANCE hInst = ::LoadLibrarh( TEXT( "odbc32" ) );
    sqlAllocInfo = (SQLALLOCINFO *)lib.GetSymbol( "SQLAllocHandle" );
    if( sqlAllocInfo )
        sqlAllocInfo( SQL_HANDLE_ENV, SQL_NULL_HENV, &env );

尝试执行此代码我遇到以下错误:

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.

所以现在我的问题是:如何声明函数?

谢谢。

P.S。:尝试在Windows 8上使用MSVC 2010构建执行程序。该程序是使用Unicode支持构建的。

0 个答案:

没有答案