Page 1 of 1

Unhandled Memory Exception problems when return to blitzmax

Posted: Fri Mar 02, 2007 8:43 pm
by spacefractal
I have wonder while a procedure works, but allways got a "Unhandled Memory Exception Error" message when returning to Blitz+ and Blitzmax with some BASS functions.

I'm are really tired of it. last time Im used a thread, with some of these problem functions, that elsewice caused a error to blitzmax. That thread was never ended.

but is it a better method?

Code: Select all

ProcedureDLL.l BASS_Init(device.l, freq.l, path$)
  Dir.s=path$+"plugins\"
  Formats=""
  BASS_ID=OpenLibrary(#PB_Any, path$+"bass.dll") 

  RESULT=CallFunction(BASS_ID,"BASS_Init", device.l, freq.l, 0, 0, 0)
  If result=0 : ProcedureReturn RESULT : EndIf

  GetExtensions(Dir)
  Directory$ = Dir
  If ExamineDirectory(0, Directory$, "*.dll")  
    While NextDirectoryEntry(0)
      If DirectoryEntryType(0)
        FILE.S=Dir.s+DirectoryEntryName(0)
        PLUGIN=CallFunction(BASS_ID,"BASS_PluginLoad", FILE)
        If PLUGIN<>0
          var.BASS_PluginGetInfo = GetFunction(BASS_ID, "BASS_PluginGetInfo")
          *INFO.BASS_PLUGININFO = var(PLUGIN)
          FormatC=*INFO\formatc 
          For i=0 To Formatc-1
            TEXT=PeekS(*INFO\Format\exts)
            Formats=Formats+TEXT
            *INFO\Format+SizeOf(BASS_PLUGINFORM)
          Next 
        EndIf
      EndIf
    Wend
    MessageRequester(Formats,"")
    FinishDirectory(0)
  EndIf

  ProcedureReturn RESULT
EndProcedure
The above code works until it trying to return to Blitzmax.


[EDIT]

It seen it this line it dosent like, but I have no clue why it dosent work:

Code: Select all

PLUGIN=CallFunction(BASS_ID,"BASS_PluginLoad", FILE)

Posted: Fri Mar 02, 2007 8:50 pm
by Num3
Try ProcedureCDLL.l , that might do the trick ;)

Posted: Fri Mar 02, 2007 8:59 pm
by spacefractal
have allready tried that, before posting. Same error.

Posted: Fri Mar 02, 2007 9:56 pm
by Pupil
What does this line do?

Code: Select all

*INFO.BASS_PLUGININFO = var(PLUGIN) 

Posted: Fri Mar 02, 2007 11:23 pm
by spacefractal
it from a prototype I forgot to insert to the code.

Code: Select all

Prototype BASS_PluginGetInfo(handler.l)
It may been some buggy code exists in bass.dll?

IT does the same problem, when I tried to split them up. This does the same:

Code: Select all

ProcedureCDLL.l BASS_PluginLoad(File$)
  RESULT=CallFunction(BASS_ID,"BASS_PluginLoad", File$) 
  ProcedureReturn RESULT 
EndProcedure
I will try to change this into a prototype and see what happens.


Changing to a prototype even diddent help.

Posted: Sat Mar 03, 2007 12:30 am
by spacefractal
I does not know, if this is a bug in bass.dll (un4seen.com), purebasic or Blitz Max?

But I finally got a workaround that work(even it could been better, but it work).

I do most wrapper work directly in blitzmax, and use the same function listed above to retrive the extension data.

I do need to do that in Pure Basic (wich are very great with dll's for do the struct work, but just without bass calls (wich are done from blitzmax).

So I do still wounder, which language or dll who have a annyoring bug?