I have a multi-threaded application that I am adding a feature that requires SQL support. I have read the SQL Tools documentation and have used it for many years, however, I am running into a runtime issue where I get an error setting up the SQL_Threads
I am using the #LINK version of SQL Tools version 3.14
My code is placed in FF_WinMain and basically looks like the following (minus the error checking conditionals)
SQL_Authorize %mycode
Sql_Initialize(1,32,32,3,3,0,0,0)
SQL_Thread(%THREAD_MAX,16) <--- I get a runtime error: Untrapped Error #9 (Subscript/Pointer out of Range)
Is FF_WinMain executed in the primary thread (Thread 0) or is it in another thread of execution? I assume it is the primary thread.
If it is not the primary thread, where would one setup the initialization of SQL Tools?
I am check here before contacting Perfect Sync for support.
This is my way of connecting to a DataBase.
'----------------------------------------------------------------------------------------------------
Function FF_WINMAIN( ByVal hInstance As Dword, _
ByVal hPrevInstance As Dword, _
ByVal lpCmdLine As Asciiz Ptr, _
ByVal iCmdShow As Long ) As Long
' If this function returns TRUE (non-zero) then the actual WinMain will exit
' thus ending the program. You can do program initialization in this function.
Function = %FALSE 'return %TRUE if you want the program to end.
SQL_Authorize %MY_SQLT_AUTHCODE
SQL_Init
' SQL_ErrorClearAll
SQL_OpenDB "DSN=SQLxxxxxxx"
End Function
Klaas
FF_WinMain would be in the primary thread.
Thank you all. I figured that FF_WinMain is within the primary thread, but I wanted to verify.
I may have found a bug in SQL Tools SQL_Thread function. I will need to contact Perfect Sync to verify.
When the SLL version is linked in, the function fails with an Run Time error 9. Using the DLL version, I receive ERROR_BAD_PARAM_VALUE.