gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] error with ARRAY OF CHAR


From: Gaius Mulley
Subject: Re: [Gm2] error with ARRAY OF CHAR
Date: Thu, 26 Nov 2009 20:10:02 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Martin Kalbfuß <address@hidden> writes:

> the following code doesn't work
>
> -- module test --
>
> testSurface := SKVideo.LoadBMP('test.bmp');
>
> -- module SKVideo --
>
> PROCEDURE LoadBMP(file : ARRAY OF CHAR) : VideoBase.SurfacePtr;
> VAR
>      src   : VideoBase.RWOpS;
>      BMP   : VideoBase.SurfacePtr;
> BEGIN
>      src := VideoBase.SDL_RWFromFile(file, 'rb');
>      IF src = NIL THEN
>         SKGeneral.Raise();
>      END;
>
>      BMP := VideoBase.SDL_LoadBMP_RW(src , 0);
>      IF BMP = NIL THEN
>         SKGeneral.Raise();
>      END;
>      RETURN BMP;
> END LoadBMP;
>
> -- C module VideoBase --
>
> PROCEDURE SDL_LoadBMP_RW(src : RWOpS; freesrc : INTEGER) : SurfacePtr;
>
> PROCEDURE SDL_RWFromFile(file, mode : ARRAY OF CHAR) : RWOpS;
>
> I get:
>
> terminate called after throwing an instance of 'int'
>
> If I pass 'test.bmp' directly to SDL_RWFromFile inside LoadBMP it works.
> Doing STextIO.WriteString(file); inside LoadBMP shows the correct
> string. Looks like a problem with modules and ARRAY OF CHAR But I have
> no idea what's wrong.

Hi Martin,

now fixed in the CVS:

   * gm2/gm2-compiler/M2Quads.mod: fixed bug reported by Martin
     Kalbfuß <address@hidden> an unbounded actual parameter
     being passed to unbounded formal parameter in
     a DEFINITION MODULE FOR "C" module was not converted into
     the address of its data.

regards,
Gaius




reply via email to

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