1 // This file is part of BOINC.
2 // http://boinc.berkeley.edu
3 // Copyright (C) 2008 University of California
4 //
5 // BOINC is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Lesser General Public License
7 // as published by the Free Software Foundation,
8 // either version 3 of the License, or (at your option) any later version.
9 //
10 // BOINC is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 // See the GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
17 
18 #include "boinc_api.h"
19 #include "graphics_api.h"
20 
21 typedef int (*BIOG_FUNC_PTR)(BOINC_OPTIONS&);
22     // ptr to a function like boinc_init_options_general()
23 
24 // stuff in the main program that the library need to access
25 //
26 struct BOINC_MAIN_STATE {
27     BIOG_FUNC_PTR boinc_init_options_general_hook;
28     int (*boinc_is_standalone_hook)();
29     int (*boinc_get_init_data_hook)(APP_INIT_DATA&);
30     int (*set_worker_timer_hook)();
31     int (*start_timer_thread_hook)();
32     APP_CLIENT_SHM** app_client_shmp;
33 #ifdef _WIN32
34     UINT_PTR gfx_timer_id;
35 #endif
36 };
37 
38 extern int boinc_init_graphics_impl(
39     WORKER_FUNC_PTR worker, BOINC_MAIN_STATE*
40 );
41 
42 // This extern C is needed to make this code work correctly,
43 // even in a 100% C++ context.
44 // This is because we need to dlsym() resolve this function.
45 // That does not work unless the symbol is in the library in UNMANGLED form.
46 // See http://www.isotton.com/howtos/C++-dlopen-mini-HOWTO/C++-dlopen-mini-HOWTO.html
47 // for some additional discussion.
48 
49 extern "C" {
50     extern int boinc_init_options_graphics_impl(
51         BOINC_OPTIONS& opt,
52         WORKER_FUNC_PTR _worker_main,
53         BOINC_MAIN_STATE*
54     );
55 }
56 
57 extern BOINC_MAIN_STATE* g_bmsp;
58 extern void get_window_title(APP_INIT_DATA& aid, char* buf, int len);
59