Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I've been banging my head against this damned sqlite library. I couldn't get
the squeak version working in dolphin. Someone mentioned to use the callback features of sqlite, because dolphin supports callbacks nicely. So I get callback version working. But I get these exceptions occurring. a GPFault('Invalid access to memory location. Reading 0x68, IP 0x673E691F (C:\Documents and Settings\Sean\My Documents\Dolphin Smalltalk 5.1\Sean Malloy\SQLITE.dll)') I've posted the code (Please note Sqlite Test.st is not unit tests, just a simple couple of lines to show the error occurring) http://www.arcturus.com.au/Dolphin_Sqlite.zip My suspicion was that the callback block was being garbage collected, but the output to the transcript is actually occurring, so the damn thing IS being called. So I don't know what the hell is going on. Anyone offer an explanation as to the cause of the exception? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Sean Malloy wrote:
> So I get callback version working. But I get these exceptions occurring. > > a GPFault('Invalid access to memory location. Reading 0x68, IP 0x673E691F > (C:\Documents and Settings\Sean\My Documents\Dolphin Smalltalk 5.1\Sean > Malloy\SQLITE.dll)') I think it's because the sqlite library is using the 'cdecl' calling convention, rather than 'stdcall' (not that they bother to /tell/ you that anywhere, not even in the source -- it must be a flag to the compiler). If you change SqliteLibrary>>resultForQuery:on:do: to read: =================== resultForQuery: aString on: sqliteRef do: operation | descriptor callback error | descriptor := ExternalDescriptor fromString: 'cdecl: sdword void* dword char** char**'. callback := ExternalCallback block: [ :a1 :a2 :a3 :a4 | operation value: a2 value: a3 value: a4. 0] descriptor: descriptor. error := ExternalAddress new. self apiExec: sqliteRef sql: aString callback: callback asParameter with: nil error: error. self checkError: error. =================== then you should be able to move on to the next stage of trying to make sense of the LPVOIDs (which /always/ confuse me). -- chris |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
> I think it's because the sqlite library is using the 'cdecl' calling
> convention, rather than 'stdcall' (not that they bother to /tell/ you that > anywhere, not even in the source -- it must be a flag to the compiler). If you > change SqliteLibrary>>resultForQuery:on:do: to read: > > =================== > resultForQuery: aString on: sqliteRef do: operation > | descriptor callback error | > descriptor := ExternalDescriptor fromString: 'cdecl: sdword void* dword char** > char**'. > callback := ExternalCallback > block: [ :a1 :a2 :a3 :a4 | operation value: a2 value: a3 value: a4. 0] > descriptor: descriptor. > error := ExternalAddress new. > self apiExec: sqliteRef sql: aString callback: callback asParameter with: nil > error: error. > self checkError: error. > =================== > > then you should be able to move on to the next stage of trying to make sense of > the LPVOIDs (which /always/ confuse me). Chris, I've just leveled up. Bonus round time! Thanks. That was it!! Regards, Sean |
Free forum by Nabble | Edit this page |