16# pragma comment(linker, "/include:cpu_check_win32")
20#if defined(WITH_TBB_MALLOC) && defined(_MSC_VER) && defined(NDEBUG)
21# pragma comment(lib, "tbbmalloc_proxy.lib")
22# pragma comment(linker, "/include:__TBB_malloc_proxy")
58#ifndef WITH_PYTHON_MODULE
79#ifdef WITH_OPENGL_BACKEND
90# include <floatingpoint.h>
115#if defined(WIN32) && !defined(WITH_PYTHON_MODULE)
116# define USE_WIN32_UNICODE_ARGS
128 app_state.signal.use_crash_handler =
true;
129 app_state.signal.use_abort_handler =
true;
145 fputs(errorStr, stderr);
162#ifndef WITH_PYTHON_MODULE
166#ifdef USE_WIN32_UNICODE_ARGS
182#ifndef WITH_PYTHON_MODULE
183 if (app_init_data->
ba) {
185 app_init_data->
ba =
nullptr;
189#ifdef USE_WIN32_UNICODE_ARGS
190 if (app_init_data->argv) {
191 while (app_init_data->argv_num) {
192 free((
void *)app_init_data->argv[--app_init_data->argv_num]);
194 free((
void *)app_init_data->argv);
195 app_init_data->argv =
nullptr;
227#ifdef WITH_PYTHON_MODULE
230int main_python_enter(
int argc,
const char **argv);
231void main_python_exit();
234# define main main_python_enter
235static void *evil_C =
nullptr;
239# include <crt_externs.h>
240char **environ =
nullptr;
251#if (defined(WITH_TBB_MALLOC) && defined(_MSC_VER) && defined(NDEBUG) && defined(WITH_GMP)) || \
254# include "tbb/scalable_allocator.h"
258 return scalable_malloc(
size);
262 return scalable_realloc(
ptr, new_size);
297#if defined(__APPLE__)
309#ifdef USE_WIN32_UNICODE_ARGS
317#ifndef WITH_PYTHON_MODULE
326 app_init_data.
early_exit = &app_init_data_early_exit;
334 setvbuf(stdout,
nullptr, _IONBF, 0);
340# ifdef USE_WIN32_UNICODE_ARGS
345 wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc);
346 app_init_data.argv =
static_cast<char **
>(malloc(argc *
sizeof(
char *)));
347 for (
int i = 0;
i < argc;
i++) {
353 app_init_data.argv_num = argc;
355 const char **argv =
const_cast<const char **
>(app_init_data.argv);
359#if defined(WITH_OPENGL_BACKEND) && BLI_SUBPROCESS_SUPPORT
360 if (
STREQ(argv[0],
"--compilation-subprocess")) {
362 GPU_compilation_subprocess_run(argv[1]);
373 for (
i = 0;
i < argc;
i++) {
374 if (
STR_ELEM(argv[
i],
"-d",
"--debug",
"--debug-memory",
"--debug-all")) {
375 printf(
"Switching to fully guarded memory allocator.\n");
379 if (
STR_ELEM(argv[
i],
"--",
"-c",
"--command")) {
389 const tm *tm = gmtime(&temp_time);
395 const char *unknown =
"date-unknown";
412 app_init_data_early_exit.
C =
C;
414#ifdef WITH_PYTHON_MODULE
416 environ = *_NSGetEnviron();
431#if defined(WITH_TBB_MALLOC) && defined(_MSC_VER) && defined(NDEBUG) && defined(WITH_GMP)
437#if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE) && !defined(WITH_HEADLESS)
439 if (argc == 2 &&
STRPREFIX(argv[1],
"-psn_")) {
440 static char firstfilebuf[512];
446 argv[1] = firstfilebuf;
475#ifndef WITH_PYTHON_MODULE
479 app_init_data.
ba = ba;
488 G.factory_startup =
true;
501#ifndef WITH_PYTHON_MODULE
539#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
559#ifndef WITH_PYTHON_MODULE
560 if (
G.background == 0) {
570 "\n* WARNING * - Blender compiled without Python!\n"
571 "this is not intended for typical usage\n\n");
581#ifndef WITH_PYTHON_MODULE
594#ifndef WITH_PYTHON_MODULE
599#ifdef USE_WIN32_UNICODE_ARGS
604#ifndef WITH_PYTHON_MODULE
607 if (
app_state.main_arg_deferred !=
nullptr) {
612 exit_code =
G.is_break ? EXIT_FAILURE : EXIT_SUCCESS;
635#ifdef WITH_PYTHON_MODULE
636void main_python_exit()
void BKE_appdir_program_path_init(const char *argv0) ATTR_NONNULL(1)
void BKE_blender_atexit_register(void(*func)(void *user_data), void *user_data)
void BKE_blender_atexit_unregister(void(*func)(void *user_data), const void *user_data)
void BKE_blender_globals_init()
void BKE_blender_globals_clear()
void BKE_brush_system_init()
void BKE_callback_global_init()
void CTX_free(bContext *C)
void BKE_cpp_types_init()
General operations, lookup, etc. for materials.
void BKE_materials_init()
void BKE_particle_init_rng(void)
void BKE_shaderfx_init(void)
void BKE_sound_force_device(const char *device)
void BKE_sound_init_once()
void BKE_vfont_builtin_register(const void *mem, int size)
A general argument parsing module.
void BLI_args_destroy(struct bArgs *ba)
struct bArgs * BLI_args_create(int argc, const char **argv)
void BLI_args_parse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *default_data)
#define BLI_assert_unreachable()
#define BLI_STATIC_ASSERT(a, msg)
void BLI_kdtree_nd_ free(KDTree *tree)
void BLI_setenv(const char *env, const char *val) ATTR_NONNULL(1)
const char * BLI_getenv(const char *env) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
char * STRNCPY(char(&dst)[N], const char *src)
void BLI_system_backtrace(FILE *fp)
void BLI_task_scheduler_init(void)
void BLI_threadapi_init(void)
void CLG_output_use_basename_set(int value)
void CLG_output_use_memory_set(int value)
void CLG_output_use_source_set(int value)
void CLG_fatal_fn_set(void(*fatal_fn)(void *file_handle))
void CLG_output_use_timestamp_set(int value)
void DEG_free_node_types()
void DEG_register_node_types()
blenloader genfile private function prototypes
void DNA_sdna_current_free(void)
void DNA_sdna_current_init(void)
const char datatoc_bfont_pfb[]
int datatoc_bfont_pfb_size
void FRS_set_context(struct bContext *C)
int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
Read Guarded memory(de)allocation.
ulong build_commit_timestamp
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static void callback_main_atexit(void *user_data)
static void main_callback_setup()
void * gmp_realloc(void *ptr, size_t, size_t new_size)
void * gmp_alloc(size_t size)
static void restore_ld_preload()
void gmp_free(void *ptr, size_t)
void gmp_blender_init_allocator()
ApplicationState app_state
static void callback_mem_error(const char *errorStr)
static void callback_clg_fatal(void *fp)
void main_arg_deferred_free()
int main_args_handle_load_file(int, const char **argv, void *data)
int main_arg_deferred_handle()
void main_args_setup(bContext *C, bArgs *ba, bool all)
void main_signal_setup_background(void)
@ ARG_PASS_SETTINGS_FORCE
void main_signal_setup(void)
void MEM_init_memleak_detection()
void libmv_initLogging(const char *argv0)
void(* MEM_set_error_callback)(void(*func)(const char *))
void MEM_use_guarded_allocator()
CreatorAtExitData_EarlyExit * early_exit
void RE_texture_rng_init()
char * alloc_utf_8_from_16(const wchar_t *in16, size_t add)
void WM_main(bContext *C)
void WM_init_splash_on_startup(bContext *C)
void WM_exit(bContext *C, const int exit_code)
void WM_exit_ex(bContext *C, const bool do_python_exit, const bool do_user_exit_actions)
void WM_init(bContext *C, int argc, const char **argv)