help with dll and memory errors

Just starting out? Need help? Post your questions and find answers here.
ehowington
Enthusiast
Enthusiast
Posts: 114
Joined: Sat Sep 12, 2009 3:06 pm

help with dll and memory errors

Post by ehowington »

So i have been with some limited success trying to load a dll and getting some returns of its functions however When I attempt to run a spatialite_alloc_connection or some of the commands memory errors bare in mind this a ton of me playing around commenting out stuff.

Code: Select all

UseSQLiteDatabase()
Macro Void : EndMacro
Prototype spatialite_alloc_connection()
If OpenLibrary(0, "mod_spatialite.dll")
  If IsLibrary(0)
    ExamineLibraryFunctions(0)
    For i = 1 To CountLibraryFunctions(0)

    Debug i
    NextLibraryFunction()
    Debug LibraryFunctionName()

  Next 
EndIf
  If CreateFile(0, "test.sqlite")
    ;Debug "Database file created"
    CloseFile(0)
  EndIf
  resultdb = OpenDatabase(0,"test.sqlite","","")
  If resultdb
  CallCFunction(0, "spatialite_initialize")
  ;Debug PeekS(*MessageBox,100,#PB_Ascii)
  CallCFunction(0, "spatialite_set_verbode_mode",1)
  ;Debug PeekS(*MessageBox2,100,#PB_Ascii)
  *result = CallCFunction(0, "spatialite_version")
  Debug PeekS(*result,100,#PB_Ascii)
  void *cache = AllocateMemory(5000,#PB_Memory_NoClear)
  ;*cache = AllocateMemory(5000,#PB_Memory_NoClear)
   ;*cache = CallCFunction(0, "spatialite_alloc_connection")
    
    CallCFunction(0, "spatialite_init_ex",DatabaseID(0), *cache, 0);
      ;cache = spatialite_alloc_connection ();
    ;spatialite_init_ex (handle, cache, 0);
  ;*result2 = CallCFunction(0, "update_layer_statistics",resultdb)
  ;PokeI(*result2,9)
  ;Debug PeekI(*result2)
      ;*cache = CallCFunction(0, "spatialite_alloc_connection")
    ;spatialite_init_ex (handle, cache, 0);
  ;*MessageBox2 = CallCFunction(0, "spatialite_init_ex",DatabaseID(0) , *cache, 0)
  ;Debug PeekS(*MessageBox2,100,#PB_Ascii)
  ;Result = CallCFunction(0, "spatialite_init_ex" [,Parameter1 [, Parameter2...]])
  ;*db = CallCFunction(0, "spatialite_init_ex",DatabaseID(0) , *db, #True)
  ;Debug PeekS(*db,100,#PB_Ascii)
  ;test.i =  IsLibrary(0)
  ;result.i = GetFunctionEntry(0, 3)
  ;result$ = LibraryFunctionName()
 EndIf 
;Debug result
Debug test$
;Debug result$
  CloseLibrary(0)
Else
  Debug "ERROR"
EndIf
 
ehowington
Enthusiast
Enthusiast
Posts: 114
Joined: Sat Sep 12, 2009 3:06 pm

Re: help with dll and memory errors

Post by ehowington »

From what I can tell it seems to maybe want some type of threaded memory bank but not sure how to implement it.
Post Reply