Help with FFI - another try

Bert Freudenberg bert at impara.de
Wed Jul 19 16:48:28 UTC 2006


I think it looks fine. But there's a lot that can go wrong when you  
do FFI. You need to check and double-check everything actually does  
what you think it does. A C debugger might help, too.

- Bert -

Am 19.07.2006 um 17:06 schrieb Eugene Beschastnov:

> So
> 	samples := (SampledSound fromWaveFileNamed: 'Message.wav')
> asSampledSound samples.
> 	'some code skipped...'
> 	buf := samples copyFrom: startOfChunk to: endOfChunk.
> 	'some more code skipped...'
> 	errCode := self
> 			apiBeEncodeChunkHbeStream: hbeStream
> 			nSamples: buf size
> 			pSamples: buf
> 			pOutput: pMp3Buffer
> 			pdwOutput: pDwWrite.
>
> should be OK? But I already tried this and VM crashed (just checked  
> again).
>
> Here is stack dump, but I don't see any helpful in it:
> ---------------------------------------------------------------------
> Wed Jul 19 21:48:10 2006
>
> Exception code: C0000005
> Exception addr: 04AD26D8
> Access violation (write access) at 11A0A000
> EAX:00000000    EBX:04BA0048    ECX:00000010    EDX:000000D8
> ESI:04B91B98    EDI:11A0A000    EBP:04BA7D6C    ESP:000670B8
> EIP:04AD26D8    EFL:00010206
> FP Control: FFFF027F
> FP Status:  FFFF4877
> FP Tag:     FFFFFFFF
> VM Version: Squeak 3.7.1 (release) from Sep 23 2004
> Compiler: gcc 2.95.2 19991024 (release)
>
> Current byte code: 32
> Primitive index: 120
>
> Loaded plugins:
>    SocketPlugin 23 September 2004 (i)
>    lame_enc.dll
>    SqueakFFIPrims 23 September 2004 (e)
>    SoundPlugin 23 September 2004 (i)
>    LargeIntegers v1.3 23 September 2004 (i)
>    Matrix2x3Plugin 23 September 2004 (i)
>    FloatArrayPlugin 23 September 2004 (i)
>    B2DPlugin 23 September 2004 (i)
>    BitBltPlugin 23 September 2004 (i)
>    SecurityPlugin 23 September 2004 (i)
>    FilePlugin 23 September 2004 (i)
>    MiscPrimitivePlugin 23 September 2004 (i)
>
>
> Stack dump:
>
> 291203288 LameEncoder class>testEncode
> 291203176 UndefinedObject>DoIt
> 291200616 Compiler>evaluate:in:to:notifying:ifFail:logged:
> 291200708 [] in ParagraphEditor>evaluateSelection
> 291200432 BlockContext>on:do:
> 291200340 ParagraphEditor>evaluateSelection
> 291200248 ParagraphEditor>doIt
> 291200524 [] in ParagraphEditor>doIt:
> 291200156 Controller>terminateAndInitializeAround:
> 291200064 ParagraphEditor>doIt:
> 291199816 ParagraphEditor>dispatchOnCharacter:with:
> 291199724 TextMorphEditor>dispatchOnCharacter:with:
> 291199632 ParagraphEditor>readKeyboard
> 291199540 TextMorphEditor>readKeyboard
> 291199176 [] in TextMorph>keyStroke:
> 291199084 TextMorph>handleInteraction:fromEvent:
> 291198992 TextMorphForEditView>handleInteraction:fromEvent:
> 291198848 TextMorph>keyStroke:
> 291198756 TextMorphForEditView>keyStroke:
> 291198664 TextMorph>handleKeystroke:
> 291198296 KeyboardEvent>sentTo:
> 291198204 Morph>handleEvent:
> 291198112 Morph>handleFocusEvent:
> 291198388 [] in HandMorph>sendFocusEvent:to:clear:
> 291198480 [] in PasteUpMorph>becomeActiveDuring:
> 291198020 BlockContext>on:do:
> 291197928 PasteUpMorph>becomeActiveDuring:
> 291197704 HandMorph>sendFocusEvent:to:clear:
> 291197612 HandMorph>sendEvent:focus:clear:
> 291197520 HandMorph>sendKeyboardEvent:
> 291197428 HandMorph>handleEvent:
> 291197208 HandMorph>processEvents
> 291197300 [] in WorldState>doOneCycleNowFor:
> 291197116 SequenceableCollection>do:
> 291197024 WorldState>handsDo:
> 291196932 WorldState>doOneCycleNowFor:
> 291196840 WorldState>doOneCycleFor:
> 291196748 PasteUpMorph>doOneCycle
> 288143892 [] in Project class>spawnNewProcess
> 288144076 [] in BlockContext>newProcess




More information about the Squeak-dev mailing list