About building a small lib that uses SDL

Hi all, well I think topic doesn’t match what I’m going to say…

All I want to do is to build a small library that will allow me to do:

gcc -o mySDLproggie mySDLproggie.c

read :

gcc -o prog prog.c -lmySDL

where mySDL should be the lib I wrote that uses SDL.
also programs that will use mySDL shouldn’t be linked with -lSDL
(How to static link mySDL to SDL ? )

Hmmm I think it’s not clear to you …

Thanks to everyone :wink:

Let’s say I have:

/* my-sdl.h: */
#include <stdlib.h>
#include <SDL/SDL.h>

void mySDLinit ( … );
void mySDLquit ( …);
/* ------ */

/* my-sdl-init.c: */
#include “my-sdl.h”

void mySDLinit (…)

/* ------ */

/* my-sdl-quit.c */
#include “my-sdl.h”

void mySDLquit (…)

/* ------ */

/* Makefile */

SOURCES = my-sdl-init.c my-sdl-quit.c
OBJECTS = $(SOURCES:.c=.o) /usr/local/lib/libSDL.a

default:: esdl_lib

esdl_lib $(eSDL_LIB): $(OBJECTS)
$(AR) -rc $(eSDL_LIB) $(OBJECTS)

$(CC) $(CFLAGS) -c $<–

  • @G.Gabriele ---------------+
    | Linux |
    ±--------------- the free philosophy -+

Well, what’s the problem? SDL is free software, so you can hack it any
way you like. You can legally do it as long as it’s also LGPL.–

| Rafael R. Sevilla @Rafael_R_Sevilla |
| Instrumentation, Robotics, and Control Laboratory |

College of Engineering, University of the Philippines, Diliman