Quantcast
Viewing all articles
Browse latest Browse all 15705

hao to call Sqlite3.dll with cdecl?

With m_cCDECL
sqlite3_exec = .CallFunc("sqlite3_exec", sqlite3, VarPtr(bvData(0)), 0, 0, 0)
End With

I WANT TO DO LIKE THIS:
address1=GetProADDRESS (dll,"sqlite3_exec")

bind_dllto_address(address1,addressof Mysqlite3_exec)

function Mysqlite3_exec(ByVal sqlite3 As Long, ByVal zSql As long)
'ASMCODE:
'CALL address1(sqlite3 ,zSql )
'clear something?
end function


this code maybe to slowly!
Code:

Public Function sqlite3_exec(ByVal sqlite3 As Long, ByVal zSql As String) As Long
    'int sqlite3_exec(
    '  sqlite3*,                                  /* An open database */
    '  const char *sql,                          /* SQL to be evaluated */
    '  int (*callback)(void*,int,char**,char**),  /* Callback function */
    '  void *,                                    /* 1st argument to callback */
    '  char **errmsg                              /* Error msg written here */
    ');
     
    Dim bvData()    As Byte
    Dim lSize      As Long
    Dim lRet        As Long
   
    If LenB(zSql) Then
        lSize = Len(zSql) * 4
        ReDim bvData(lSize)
   
        lRet = WideCharToMultiByte(CP_UTF8, 0, StrPtr(zSql), Len(zSql), bvData(0), lSize + 1, vbNullString, 0)
   
        If lRet Then
            ReDim Preserve bvData(lRet - 1)
        End If
    End If

    If m_bLoaded Then
        With m_cCDECL
            sqlite3_exec = .CallFunc("sqlite3_exec", sqlite3, VarPtr(bvData(0)), 0, 0, 0)
        End With
    Else
        sqlite3_exec = SQLITE_ERROR
    End If
End Function


Viewing all articles
Browse latest Browse all 15705

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>