Hello! I've played with jhc and sdl binding a bit on osx. Unfortunately it does not worked. The original example compiled, but exited with exception. (it said the there is no autoreleasepool defined...) After a little modification I've got correct haskell code, what fails with gcc. I've attached the source file. Cheers, Csaba Here is the output: *jhc -p SDL test.hs -o test --optc=-I/opt/local/include/SDL --optc=-D_GNU_SOURCE=1 --optc=-D_THREAD_SAFE --optc=-L/opt/local/lib --optc=-lSDLmain --optc=-lSDL --optc=-Wl,-framework,Cocoa* *jhc 0.7.6 (0.7.6-3)* *Finding Dependencies...* *Using Ho Cache: '/Users/hruskacsaba/.jhc/cache'* *Main [test.hs] <~/.jhc/cache/sapvdjvngcil41e08abohho0f9.ho>* *Fresh: <~/.jhc/cache/sapvdjvngcil41e08abohho0f9.ho>* *Typechecking...* *Compiling...* *Collected Compilation...* *-- typeAnalyzeMethods* *-- BoxifyProgram* *-- Boxy WorkWrap* *-- LambdaLift* *E* *├─case: 696* *├─case-alt: 1160* *├─error: 10* *├─lambda: 193* *├─let-binding: 206* *├─lit: 2336* *├─other: 417* *├─prim: 240* *└─var-use: 1478* *Converting to Grin...* *Found 0 CAFs to convert to constants, 0 of which are recursive.* *Recursive* * * *Constant* * * *CAFS* *theMain$7 v-1341403669 (FtheMain$7)* *theMain$6 v-1345597973 (FtheMain$6)* *-- eval ni70382562 WHNF-[CJhc.Addr.Ptr]* *-- eval ni240266248 WHNF-[CGraphics.UI.SDL.Events.SDLVideoResize,CGraphics.UI.SDL.Events.SDLSysWMEvent,CGraphics.UI.SDL.Events.SDLQuit,CGraphics.UI.SDL.Events.SDLJoyButtonUp,CGraphics.UI.SDL.Events.SDLJoyButtonDown,CGraphics.UI.SDL.Events.SDLJoyHatMotion,CGraphics.UI.SDL.Events.SDLJoyBallMotion,CGraphics.UI.SDL.Events.SDLJoyAxisMotion,CGraphics.UI.SDL.Events.SDLMouseButtonUp,CGraphics.UI.SDL.Events.SDLMouseButtonDown,CGraphics.UI.SDL.Events.SDLMouseMotion,CGraphics.UI.SDL.Events.SDLKeyUp,CGraphics.UI.SDL.Events.SDLKeyDown,CGraphics.UI.SDL.Events.SDLActiveEvent,CGraphics.UI.SDL.Events.SDLNoEvent,CGraphics.UI.SDL.Events.SDLUserEvent] * *-- eval ni230871714 WHNF-[CGraphics.UI.SDL.Keysym.Keysym]* *-- eval ni66805364 WHNF-[CGraphics.UI.SDL.Keysym.Keysym]* *-- eval ni735449157 WHNF-[P3_W@.fInstance@ .iForeign.Storable.peek.Graphics.UI.SDL.Events.Event$2,P3_W@.fInstance@ .iForeign.Storable.peek.Graphics.UI.SDL.Events.Event$3]* *-- eval ni166760994 WHNF-[CInt#]* *-- eval ni23258552 WHNF-[CJhc.Prim.[],CJhc.Prim.:]* *-- eval ni49754508 WHNF-[CJhc.Maybe.Nothing,CJhc.Maybe.Just]* *-- eval ni78697292 WHNF-[CWord32#]* *-- eval ni174292042 WHNF-[CJhc.Maybe.Nothing,CJhc.Maybe.Just]* *-- eval ni813569055 WHNF-[P2_Graphics.UI.SDL.Video.fillRect$2]* *-- eval ni1055524921 WHNF-[P2_Foreign.C.String.withCString$2,P2_Foreign.Marshal.Utils.with$2,P2_Graphics.UI.SDL.Events.228_wait] * *-- eval ni2300728 WHNF-[CJhc.Addr.Ptr]* *-- eval ni70310210 WHNF-[CJhc.Basics.(,)]* *-- eval ni1503142939 WHNF-[?]* *-- eval ni21331994 WHNF-[CJhc.Prim.[],CJhc.Prim.:]* *-- eval ni15337342 WHNF-[CGraphics.UI.SDL.Events.Focus#,CGraphics.UI.SDL.Keysym.Modifier#]* *-- eval ni110932008 WHNF-[CGraphics.UI.SDL.Events.Focus#,CGraphics.UI.SDL.Keysym.Modifier#]* *-- eval ni106881404 WHNF-[CWord32#,CWord8#]* *-- eval ni106881404 WHNF-[CWord32#,CWord8#]* *-- eval ni1809191493 WHNF-[CWord32#,CWord8#]* *-- eval ni1809191493 WHNF-[CWord32#,CWord8#]* *-- eval ni10795820 WHNF-[CWord8#]* *-- eval ni174120830 WHNF-[CGraphics.UI.SDL.Events.Focus#,CGraphics.UI.SDL.Keysym.Modifier#]* *-- eval ni3774298 WHNF-[CGraphics.UI.SDL.Events.Focus#,CGraphics.UI.SDL.Keysym.Modifier#]* *-- eval ni217071266 WHNF-[P2_Main.display$7,P2_Graphics.UI.SDL.Video.fillRect$4]* *-- eval ni100884800 WHNF-[P2_theMain$5,P2_theMain$3,P2_theMain$4,P2_theMain$2]* *-- eval ni185293000 WHNF-[CJhc.Addr.Ptr]* *-- apply nd100122 WHNF-[P2_Graphics.UI.SDL.Video.fillRect$2]* *(fMain.display$6,1) -> S* *(fMain.display$4,0) -> S* *(fGraphics.UI.SDL.General.failWithError$2,0) -> S* *(fGraphics.UI.SDL.Video.fillRect,1) -> S* *(fGraphics.UI.SDL.Video.fillRect,2) -> S* *(fGraphics.UI.SDL.Video.fillRect$4,0) -> S* *(fForeign.C.String.withCString,1) -> S* *(fForeign.Marshal.Utils.with,1) -> S* *(fForeign.Marshal.Alloc.alloca,0) -> S* *(fForeign.Marshal.Alloc.alloca,1) -> S* *(fW@.fForeign.Marshal.Alloc.allocaBytes,1) -> S* *(fInstance@.iJhc.Show.show.default,0) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$9,0) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$9,1) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$6,0) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$5,0) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$4,1) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$4,2) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$2,0) -> S* *(fInstance@.iGraphics.UI.SDL.Utilities.toEnum.Graphics.UI.SDL.Events.MouseButton,0) -> S* *(fGraphics.UI.SDL.Utilities.fromEnum,0) -> S* *(fGraphics.UI.SDL.Utilities.fromEnum,1) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$7,0) -> S* *(fGraphics.UI.SDL.Utilities.fromBitmask$7,1) -> S* *(fForeign.Marshal.Utils.with$2,0) -> S* *(fW@.fInstance@.iForeign.Storable.pokeElemOff.default,0) -> S* *(fW@.fInstance@.iForeign.Storable.pokeByteOff.default,0) -> S* *(fForeign.Storable.poke,0) -> S* *(fForeign.Storable.poke,1) -> S* *(fForeign.C.String.withCString$2,0) -> S* *(fW@.fGraphics.UI.SDL.Events.peekMouse,0) -> S* *(bapply_36712,0) -> S* *(bapply_36713,0) -> S* *r34 -> S* *r39 -> S* *r40 -> S* *r41 -> S* *r42 -> S* *r85 -> S* *r86 -> S* *r87 -> S* *r88 -> S* *r89 -> S* *r123 -> S* *r124 -> S* *r125 -> S* *r126 -> S* *r131 -> S* *r133 -> S* *r136 -> S* *r137 -> S* *r138 -> S* *r139 -> S* *r140 -> S* *Writing "test_code.c"* *Running: gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math -Wextra -Wall -Wno-unused-parameter -o test test_code.c -DNDEBUG -O3 -I/opt/local/include/SDL '-D_GNU_SOURCE=1' -D_THREAD_SAFE -L/opt/local/lib -lSDLmain -lSDL '-Wl,-framework,Cocoa'* *test_code.c: In function ‘fForeign_C_String_withCString’:* *test_code.c:4297: warning: initialization from incompatible pointer type* *test_code.c: In function ‘fForeign_Marshal_Utils_with’:* *test_code.c:4404: warning: initialization from incompatible pointer type* *test_code.c:4409: warning: initialization from incompatible pointer type* *test_code.c: In function ‘fGraphics_UI_SDL_Events_waitEventBlocking$d2’:* *test_code.c:4571: warning: implicit declaration of function ‘SDL_WaitEvent’ * *test_code.c: In function ‘fGraphics_UI_SDL_General_failWithError’:* *test_code.c:4598: warning: implicit declaration of function ‘SDL_GetError’* *test_code.c:4599: error: ‘v74’ undeclared (first use in this function)* *test_code.c:4599: error: (Each undeclared identifier is reported only once* *test_code.c:4599: error: for each function it appears in.)* *test_code.c: In function ‘fGraphics_UI_SDL_Video_fillRect’:* *test_code.c:5341: warning: initialization from incompatible pointer type* *test_code.c:5345: warning: initialization from incompatible pointer type* *test_code.c: In function ‘fGraphics_UI_SDL_Video_fillRect$d2’:* *test_code.c:5360: warning: implicit declaration of function ‘SDL_FillRect’* *test_code.c: In function ‘fGraphics_UI_SDL_Video_fillRect$d3’:* *test_code.c:5370: warning: comparison between signed and unsigned* *test_code.c: In function ‘fMain_display’:* *test_code.c:5757: warning: implicit declaration of function ‘SDL_GetVideoSurface’* *test_code.c:5764: warning: initialization from incompatible pointer type* *test_code.c:5767: warning: assignment from incompatible pointer type* *test_code.c:5781: warning: implicit declaration of function ‘SDL_MapRGB’* *test_code.c:5784: warning: initialization from incompatible pointer type* *test_code.c:5787: warning: initialization from incompatible pointer type* *test_code.c:5813: warning: initialization from incompatible pointer type* *test_code.c:5824: warning: implicit declaration of function ‘SDL_Flip’* *test_code.c: In function ‘fMain_display$d7’:* *test_code.c:5879: warning: implicit declaration of function ‘SDL_UpperBlit’ * *test_code.c: In function ‘fMain_display$d8’:* *test_code.c:5889: warning: comparison between signed and unsigned* *test_code.c: In function ‘fW$__fInstance$__iForeign_Storable_pokeByteOff_default’:* *test_code.c:7802: warning: initialization from incompatible pointer type* *test_code.c: In function ‘fW$__fInstance$__iForeign_Storable_pokeElemOff_default’:* *test_code.c:7818: warning: initialization from incompatible pointer type* *test_code.c:7829: warning: initialization from incompatible pointer type* *test_code.c:7840: warning: initialization from incompatible pointer type* *test_code.c:7851: warning: initialization from incompatible pointer type* *test_code.c: In function ‘ftheMain’:* *test_code.c:8147: warning: implicit declaration of function ‘SDL_SetVideoMode’* *test_code.c:8154: warning: initialization from incompatible pointer type* *test_code.c:8157: warning: assignment from incompatible pointer type* *test_code.c:8167: warning: statement with no effect* *test_code.c:8170: warning: implicit declaration of function ‘SDL_EnableUNICODE’* *test_code.c:8185: warning: implicit declaration of function ‘SDL_LoadBMP_RW’* *test_code.c:8192: warning: initialization from incompatible pointer type* *test_code.c:8195: warning: assignment from incompatible pointer type* *test_code.c:8235: warning: statement with no effect* *test_code.c:8240: warning: statement with no effect* *test_code.c:8249: warning: statement with no effect* *test_code.c:8254: warning: statement with no effect* *test_code.c: In function ‘ftheMain$d2’:* *test_code.c:8269: warning: implicit declaration of function ‘SDL_WM_SetCaption’* *test_code.c: In function ‘ftheMain$d3’:* *test_code.c:8282: warning: initialization from incompatible pointer type* *test_code.c: In function ‘ftheMain$d4’:* *test_code.c:8293: warning: implicit declaration of function ‘SDL_RWFromFile’* *test_code.c: In function ‘ftheMain$d5’:* *test_code.c:8317: warning: initialization from incompatible pointer type* *jhc: user error (C code did not compile.)*
participants (1)
-
Csaba Hruska