| 1 | /* |
| 2 | This file is part of GOTCHA. For copyright information see the COPYRIGHT |
| 3 | file in the top level directory, or at |
| 4 | https://github.com/LLNL/gotcha/blob/master/COPYRIGHT |
| 5 | This program is free software; you can redistribute it and/or modify it under |
| 6 | the terms of the GNU Lesser General Public License (as published by the Free |
| 7 | Software Foundation) version 2.1 dated February 1999. This program is |
| 8 | distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 9 | without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 10 | PURPOSE. See the terms and conditions of the GNU Lesser General Public License |
| 11 | for more details. You should have received a copy of the GNU Lesser General |
| 12 | Public License along with this program; if not, write to the Free Software |
| 13 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 14 | */ |
| 15 | /** |
| 16 | * This file contains utilities for cases where users say something (wrap main) |
| 17 | * that doesn't work, but can be translated to something that does work |
| 18 | */ |
| 19 | #ifndef GOTCHA_SRC_TRANSLATIONS_H |
| 20 | #define GOTCHA_SRC_TRANSLATIONS_H |
| 21 | #include <gotcha/gotcha.h> |
| 22 | |
| 23 | /** "int main" wrapping handling */ |
| 24 | typedef int (*libc_start_main_t)(int (*)(int, char **, char **), int, char **, |
| 25 | void (*)(), void (*)(), void (*)(), void *); |
| 26 | typedef int (*main_t)(int argc, char **argv, char **envp); |
| 27 | |
| 28 | extern int main_wrapped; |
| 29 | extern gotcha_wrappee_handle_t gotcha_internal_libc_main_wrappee_handle; |
| 30 | extern gotcha_wrappee_handle_t gotcha_internal_main_wrappee_handle; |
| 31 | |
| 32 | int gotcha_internal_main(int argc, char **argv, char **envp); |
| 33 | int gotcha_internal_libc_start_main(int (*)(int, char **, char **), int, |
| 34 | char **, void (*)(), void (*)(), void (*)(), |
| 35 | void *); |
| 36 | |
| 37 | extern struct gotcha_binding_t libc_main_wrappers[]; |
| 38 | extern struct gotcha_binding_t main_wrappers[]; |
| 39 | |
| 40 | #endif |