Skip to content

Instantly share code, notes, and snippets.

@Privilger
Created September 6, 2020 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Privilger/809c40b6b443452e1193d31578fe3155 to your computer and use it in GitHub Desktop.
Save Privilger/809c40b6b443452e1193d31578fe3155 to your computer and use it in GitHub Desktop.
a code run before main() function.
#include <iostream>
#include <algorithm>
#include <memory>
#include <string>
using namespace std;
__attribute((constructor))void before(){
cout << "before main" << endl;
}
int main(){
cout << "main func" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment