Seite 1 von 1

Programm stürzt immer ab !

Verfasst: 29.12.2004 18:33
von MVXA
Hallo !
Ich versuche grade für meine Scriptsprache API Support einzubauen. Ich habe das ganze so gelöst indem ich vorher alle Daten in einer Linked List speichere und dann beim Aufruf alle pusth. Wenn ich das so als Code habe funktioniert das ganze prima aber wenn ich das dann in eine Funktion verfrachten will stürzt mir das Programm immer aus mir einem unerklärlichem Grund ab. Könnt ihr mir sagen warum ?

Hier der Code der Funktioniert:

Code: Alles auswählen

Structure sStore
    stoDataS.s
    stoDataL.l
    stoType.l
EndStructure

Enumeration
    #TYPString
    #TYPLong
    #TYPMemory
EndEnumeration

NewList DataStore.sStore()

Global DataIn.l

AddElement(DataStore())
DataStore()\stoDataL = 0
DataStore()\stoType = #TYPLong

AddElement(DataStore())
DataStore()\stoDataL = 0
DataStore()\stoType = #TYPLong

AddElement(DataStore())
DataStore()\stoDataS = "C:\Join.wav"
DataStore()\stoType = #TYPString

OpenLibrary(0, "winmm.dll")
FunkPtr.l = IsFunction(0, "PlaySoundA")

ForEach DataStore()
    If DataStore()\stoType = #TYPLong 
         DataIn = DataStore()\stoDataL
         !PUSH dword [v_DataIn]
    ElseIf DataStore()\stoType = #TYPString
         DataIn = @DataStore()\stoDataS
         !PUSH dword [v_DataIn]
    EndIf
Next    
Result.l = CallFunctionFast(FunkPtr)
Hier die Funktion, die nicht funktioniert :(:

Code: Alles auswählen

Procedure PushMemory() 
    ForEach DataStore()
        If DataStore()\stoType = #TYPLong 
            DataIn = DataStore()\stoDataL
            !PUSH dword [v_DataIn]
        ElseIf DataStore()\stoType = #TYPString
            DataIn = @DataStore()\stoDataS
            !PUSH dword [v_DataIn]
        EndIf
    Next    
EndProcedure
steht eigentlich alles in einer Datei. Wenn ich die Funktion teste, kommentier ich den anderen code eigentlich immer aus.

Verfasst: 29.12.2004 20:54
von MVXA
es funktioniert nun :freak:. ich hab die funtktion nun so aufgebaut:

Code: Alles auswählen

Procedure PushMemory() 
    ForEach DataStore()
        If DataStore()\stoType = #TYPLong 
            DataIn = DataStore()\stoDataL
            !PUSH dword [v_DataIn]
        ElseIf DataStore()\stoType = #TYPString
            DataIn = @DataStore()\stoDataS
            !PUSH dword [v_DataIn]
        EndIf
    Next 
    !MOV    Eax,dword [v_FunkPtr]
    !CALL   PB_CallFunctionFast       
EndProcedure
wenn ich aber CallFunctionFast(FunkPtr) anstatt dem asm code da hin setze stürzt das programm weiterhin munter ab...