gm2
[Top][All Lists]
Advanced

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

[Gm2] Problems with C interface


From: Martin Kalbfuß
Subject: [Gm2] Problems with C interface
Date: Sun, 22 Nov 2009 00:52:30 +0100

Hi,

I have a file called SKVideo.mod

When I try to compile it with

gm2 -c SKVideo.mod

I get:

SKVideo.def:5:5: error: undeclared identifier(s) in DEFINITION MODULE
VideoBase.def:6:6: error: undeclared symbol (Rect)
VideoBase.def:11:6: error: undeclared symbol (ColorPtr)
VideoBase.def:13:6: error: undeclared symbol (Color)
VideoBase.def:20:6: error: undeclared symbol (PalettePtr)
VideoBase.def:22:6: error: undeclared symbol (Palette)
VideoBase.def:27:6: error: undeclared symbol (PixelFormatPtr)
VideoBase.def:29:6: error: undeclared symbol (PixelFormat)
VideoBase.def:40:6: error: undeclared symbol (SurfacePtr)
VideoBase.def:42:6: error: undeclared symbol (Surface)
VideoBase.def:52:6: error: undeclared symbol (Overlay)

VideoBase.def is a C definition module. I don't understand, why the
compiler is interested in them. I only want to compile SKVideo.mod. Not
VideoBase.c

SKVideo.mod is empty, except the import of VideoBase.

VideoBase.def has the following content:

DEFINITION MODULE FOR "C" SKVideo;

IMPORT SYSTEM;

TYPE
     Rect = RECORD
          x, y : SYSTEM.INTEGER16;
          w, h : SYSTEM.CARDINAL16;
     END;

     ColorPtr = POINTER TO Color;

     Color = RECORD
          r      : SYSTEM.CARDINAL8;
          g      : SYSTEM.CARDINAL8;
          b      : SYSTEM.CARDINAL8;
          unused : SYSTEM.CARDINAL8;
     END;

     PalettePtr = POINTER TO Palette;

     Palette = RECORD
          nColors : INTEGER;
          colors  : ColorPtr;
     END;

     PixelFormatPtr = POINTER TO PixelFormat;

     PixelFormat = RECORD
          palette                        : PalettePtr;
          bitsPerPixel                   : SYSTEM.CARDINAL8;
          bytesPerPixel                  : SYSTEM.CARDINAL8;
          rLoss, gLoss, bLoss, aLoss     : SYSTEM.CARDINAL8;
          rShift, gShift, bShift, aShift : SYSTEM.CARDINAL8;
          rMask, gMask, bMask, aMask     : SYSTEM.CARDINAL32;
          colorKey                       : SYSTEM.CARDINAL32;
          alpha                          : SYSTEM.CARDINAL8;
     END;

     SurfacePtr = POINTER TO Surface;

     Surface = RECORD
          flags     : SYSTEM.CARDINAL32;
          format    : PixelFormatPtr;
          w, h      : INTEGER;
          pitch     : SYSTEM.CARDINAL16;
          pixels    : SYSTEM.ADDRESS;
          clip_rect : Rect;
          refcount  : INTEGER;
     END;

     Overlay = RECORD
          format    : SYSTEM.CARDINAL32;
          w, h      : INTEGER;
          planes    : INTEGER;
          pitches   : POINTER TO SYSTEM.CARDINAL16;
          pixels    : POINTER TO POINTER TO SYSTEM.CARDINAL8;
          hwOverlay : BOOLEAN;
     END;

PROCEDURE InitVideo();

PROCEDURE IsVideo() : BOOLEAN; 

PROCEDURE QuitVideo();

PROCEDURE SetVideoMode(width, height, bitsperpixel : INTEGER;
fullscreen : BOOLEAN) : SurfacePtr;

PROCEDURE LoadBMP(file : ARRAY OF CHAR) : SurfacePtr;

PROCEDURE FreeSurface(surface : SurfacePtr);

PROCEDURE BlitSurface(src : SurfacePtr; srcrect : Rect; dst :
SurfacePtr; dstrect : Rect);

PROCEDURE DisplayFormat(surface : SurfacePtr) : SurfacePtr;

PROCEDURE GetClipRect(surface : SurfacePtr) : Rect;

PROCEDURE GetPixelFormat(surface : SurfacePtr) : PixelFormatPtr;

PROCEDURE MapRGB(fmt : PixelFormatPtr; r, g, b : SYSTEM.CARDINAL8) :
SYSTEM.CARDINAL32;

PROCEDURE SetColorKey(surface : SurfacePtr; key : SYSTEM.CARDINAL32;
RLEAccel : BOOLEAN) : [INTEGER];

PROCEDURE ClearColorKey(surface : Surface) : INTEGER;

PROCEDURE Flip(screen : SurfacePtr);

END SKVideo.

When I compile a C program, with gcc the modules can be individually
compiled. Only at the linking step the extern dependencies must get
solved.

So what's wrong here?

Thanks


-- 
Martin Kalbfuß <address@hidden>





reply via email to

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