Modification of SDL2

I wanted to add to SDL some functions.

  1. I downloaded source code of sdl 2.0.3 and opened solution “SDL_VS2010.sln”.
  2. I added to SDL_video.h this code:

Code:

extern DECLSPEC void * SDLCALL some_function1();
extern DECLSPEC void SDLCALL some_function2();

  1. I added to SDL_video.c this code:

Code:

void * some_function1())
{

}
void some_function2())
{

}

  1. I compiled it and got files “SDL2.lib”, “SDL2.dll”, “SDL2main.lib” and “SDL2test.lib”.
  2. I tried to use my functions in my code and got linker errors:

Code:

1>fmn_main.obj : error LNK2001: unresolved external symbol "_some_function1"
1>fmn_main.obj : error LNK2001: unresolved external symbol “_some_function2”

How to solve this problem?

Its not listed in SDL2-2.0.3\src\dynapi\SDL_dynapi_procs.h

Add the listing and recompile.

ChaoCheese wrote:> I wanted to add to SDL some functions.

  1. I downloaded source code of sdl 2.0.3 and opened solution “SDL_VS2010.sln”.
  2. I added to SDL_video.h this code:

Code:

extern DECLSPEC void * SDLCALL some_function1();
extern DECLSPEC void SDLCALL some_function2();

  1. I added to SDL_video.c this code:

Code:

void * some_function1())
{

}
void some_function2())
{

}

  1. I compiled it and got files “SDL2.lib”, “SDL2.dll”, “SDL2main.lib” and “SDL2test.lib”.
  2. I tried to use my functions in my code and got linker errors:

Code:

1>fmn_main.obj : error LNK2001: unresolved external symbol "_some_function1"
1>fmn_main.obj : error LNK2001: unresolved external symbol “_some_function2”

How to solve this problem?

How to solve this problem?

The src/dynapi/gendynapi.pl script handles this for you, but you can
hand-edit the functions, too.

Remember that adding stuff to the public API is dangerous, as it’ll make
it so people can’t swap out your copy of SDL with a different one.

–ryan.

The src/dynapi/gendynapi.pl script handles this for you, but you can
hand-edit the functions, too.

And by “functions” I mean “files.”

–ryan.