www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - SDL with DMC

reply Leo <Leo_member pathlink.com> writes:
Here is how to compile SDL programs/games with DMC: (well, there maybe better
solutions but that one worked for me...)

1). Create a sdl.def file like this

------- cut here ----------

LIBRARY sdl
EXETYPE NT
SUBSYSTEM WINDOWS
EXPORTS
_SDL_Quit  = SDL_Quit
_SDL_Init  = SDL_Init
_SDL_GetError  = SDL_GetError
_SDL_SetModuleHandle  = SDL_SetModuleHandle
_SDL_SetVideoMode  = SDL_SetVideoMode
_SDL_LockSurface  = SDL_LockSurface
_SDL_UnlockSurface  = SDL_UnlockSurface

---------------------------

(Add all the SDL functions you wish to use...)

2). Then build a lib using implib:

implib sdl.def sdl.lib

3). Download SDL sources from http://libsdl.org
Compile the file sdl_main.c (found in src/win dir)

4). Now you can link your SDL project using 'dmc myobjects sdl.lib sdl_main.o
-omyexe'

NOTE: You could also build sdl_main.lib and link with that lib instead of
linking with sdl_main.o

Hope this will help,
Leo. 
Jun 19 2003
parent "Wichetael" <wichetael gmx.net> writes:
Here was my solution for compiling SDL programs;

When compiling for Win32:
1) for sdl.lib you can simply use the sdl.lib for Borland distributed with
the SDL developer library, you could of couse always make your own.
2) for sdl_main.lib you need to make your own version with DMC, you'll need
to do a little bit of make file modifying.
3) Then when linking you need to include the /ENTRY:_WinMain 16 switch for
the linker. That because of the fact that the entry point is in the library
sdl_main and OPTLINK only looks for entry points in the object files and not
in the libraries.

basically, instead of making your own sdl.lib you can simply use the sdl.lib
for the borland compiler distributed with the sdl development library.

Regards,
Remko van der Vossen


"Leo" <Leo_member pathlink.com> wrote in message
news:bcsa75$2qss$1 digitaldaemon.com...
 Here is how to compile SDL programs/games with DMC: (well, there maybe

 solutions but that one worked for me...)

 1). Create a sdl.def file like this

 ------- cut here ----------

 LIBRARY sdl
 EXETYPE NT
 SUBSYSTEM WINDOWS
 EXPORTS
 _SDL_Quit  = SDL_Quit
 _SDL_Init  = SDL_Init
 _SDL_GetError  = SDL_GetError
 _SDL_SetModuleHandle  = SDL_SetModuleHandle
 _SDL_SetVideoMode  = SDL_SetVideoMode
 _SDL_LockSurface  = SDL_LockSurface
 _SDL_UnlockSurface  = SDL_UnlockSurface

 ---------------------------

 (Add all the SDL functions you wish to use...)

 2). Then build a lib using implib:

 implib sdl.def sdl.lib

 3). Download SDL sources from http://libsdl.org
 Compile the file sdl_main.c (found in src/win dir)

 4). Now you can link your SDL project using 'dmc myobjects sdl.lib

 -omyexe'

 NOTE: You could also build sdl_main.lib and link with that lib instead of
 linking with sdl_main.o

 Hope this will help,
 Leo.

Jun 19 2003