gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] Segmentation fault with procedure called Init


From: Gaius Mulley
Subject: Re: [Gm2] Segmentation fault with procedure called Init
Date: Fri, 06 Nov 2009 00:38:09 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Martin Kalbfuß <address@hidden> writes:

> Hi,
>
> I have a procedure called Init in a module. When I call any procedure
> from that module I get a segmentation fault. When remove Init from the
> definition module it works fine. Is Init a reserved word or
> something?

Hi,

no, but gm2 will create function symbols for

_M2_SDL_init    # the BEGIN END block of the SDL module
_M2_SDL_finish  # the FINALLY END block of the SDL module
SDL_Init
SDL_another_proc

so my guess is that SDL_Init clashes with the -lSDL.a.
Indeed:

$ nm /usr/lib/libSDL.a | grep SDL_Init 
0000000000000220 T SDL_Init
0000000000000100 T SDL_InitSubSystem
                 U SDL_InitSubSystem
                 U SDL_Init

so your function is probably never called (or maybe it is always
called and the real /usr/lib/libSDL.a is never called - resulting in
an infinite recursive cycle :-)

hope this helps..

regards,
Gaius


> **********************************************************
> DEFINITION MODULE SDL;
>
> PROCEDURE Init(flags : CARDINAL) : INTEGER;
> PROCEDURE another_proc(flags : CARDINAL) : INTEGER;
> (*PROCEDURE InitSubSystem(flags : CARDINAL) : INTEGER;*)
>
> (*PROCEDURE QuitSDL();*)
>
> (*PROCEDURE QuitSubSystem(flags : CARDINAL);*)
>
> END SDL.
>
> **********************************************************
> IMPLEMENTATION MODULE SDL;
>
> IMPORT SDLBase;
>
> PROCEDURE Init(flags : CARDINAL) : INTEGER;
> BEGIN
>      RETURN SDLBase.SDL_Init(flags);
> END Init;
>
> PROCEDURE another_proc(flags : CARDINAL) : INTEGER;
> BEGIN
>     RETURN SDLBase.SDL_Init(flags);
> END another_proc;
>
> (*
> PROCEDURE InitSubSystem(flags : CARDINAL) : INTEGER;
> BEGIN
>      RETURN SDLBase.SDL_InitSubSystem(flags);
> END InitSubSystem;
>
> PROCEDURE QuitSDL();
> BEGIN
>      SDLBase.SDL_Quit();
> END QuitSDL;
>
> PROCEDURE QuitSubSystem(flags : CARDINAL);
> BEGIN
>      SDLBase.SDL_QuitSubSystem(flags);
> END QuitSubSystem;
> *)
> END SDL.
>
> **********************************************************
> MODULE SDLtest;
>
> IMPORT SDL;
>
> VAR Err : INTEGER;
>
> BEGIN
>  Err := SDL.another_proc(0);
> END SDLtest.
>
> **********************************************************
>
>
>
> _______________________________________________
> gm2 mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/gm2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]