that's my code:
Lib.h
#ifdef ExportLib
#define Lib __declspec(dllexport)
#else
#define Lib __declspec(dllimport)
#endif
extern void Lib Launch();
Lib.cpp
#include <SDL/SDL.h>
#include "Lib.h"
void Launch() {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window* win = SDL_CreateWindow("Untitle", 100, 100, 400, 400, 0);
SDL_DestroyWindow(win);
SDL_Quit();
}
I build this code to a static library. Then I created a new source file and used this library.
main.cpp
#include "Lib.h"
int main() {
Launch();
return 0;
}
Finally, I compile main.cpp using my static library without the SDL_main be defined and the SDL's dependecies. That works fine, the window appears.
But is really fine do it? What functionalities I lost doing it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…