Mail Archives: djgpp/1997/08/19/15:13:40

Message-ID: <>
Date: Tue, 19 Aug 1997 16:41:22 -0230
From: Colin Walsh <cwalsh AT nf DOT sympatico DOT ca>
Reply-To: cwalsh AT nf DOT sympatico DOT ca
Organization: Colossal Software
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
CC: djgpp AT delorie DOT com
Subject: Re: Creating Class Libraries
References: <33F9EE76 DOT 7A91 AT nf DOT sympatico DOT ca>

Oops, forgot to put it on the Mailing list....

I have tried recently to create libraries supporting all of the
filetypes that I keep creating for my various projects, but a problem
has come up. I want the libs to use classes, but they wont compile

Here is the source that loads .CGR (Colossal GRaphics)
#include <fstream.h>
#include <malloc.h>
#include <grx20.h>
class cgrfile{
                unsigned char *cgrdata;
                long w,h;
                        cgrdata=(unsigned char *)malloc(0);
                void cgrload(char *filename,int palswitch)
                        unsigned char bit;
                        unsigned char RGB[3];
                        fstream cgr(filename,ios::in|ios::binary);
                        cgrdata=(unsigned char *)realloc((void
                        if(palswitch==0)//dont load the palette
                                for(int x=0;x<256;x++)
                        if(palswitch==1)//load the palette
                                for(int x=0;x<256;x++)
                        for(long x=0;x<w*h;x++)
                void display()
                        long pos=0;
                        for(long x=0;x<w;x++)
                                for(long y=0;y<h;x++)

And this is the batch (too bothersome to create make files w/ dos
edit(not proper Tab)) file:

gcc -c cgr.cpp -o cgr.o
ar rvs libcgr.a cgr.o
copy libcgr.a \proglang\djgpp\lib

When the COFF file is created, it is waaay too small (365 bytes) to have
all this code.
I was wondering if anyone can tell me what needs to be changed so it
compiles properly, and yes...
I have read the FAQ on compiling libraries, but there is no info on how
you compile a class library.

Thanks for any help,
Colin Walsh
President/CEO/Dictator for life :), Colossal Software

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019