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")
56#ifndef WITH_PYTHON_MODULE
82# include <floatingpoint.h>
93#ifdef WITH_CYCLES_LOGGING
105#if defined(WIN32) && !defined(WITH_PYTHON_MODULE)
106# define USE_WIN32_UNICODE_ARGS
135 fputs(errorStr, stderr);
147#ifndef WITH_PYTHON_MODULE
151#ifdef USE_WIN32_UNICODE_ARGS
156#if defined(WITH_PYTHON_MODULE) && !defined(USE_WIN32_UNICODE_ARGS)
165#ifndef WITH_PYTHON_MODULE
166 if (app_init_data->
ba) {
168 app_init_data->
ba =
nullptr;
174#ifdef USE_WIN32_UNICODE_ARGS
175 if (app_init_data->argv) {
176 while (app_init_data->argv_num) {
177 free((
void *)app_init_data->argv[--app_init_data->argv_num]);
179 free((
void *)app_init_data->argv);
180 app_init_data->argv =
nullptr;
201#ifdef WITH_PYTHON_MODULE
204int main_python_enter(
int argc,
const char **argv);
205void main_python_exit();
208# define main main_python_enter
209static void *evil_C =
nullptr;
213# include <crt_externs.h>
214char **environ =
nullptr;
225#if (defined(WITH_TBB_MALLOC) && defined(_MSC_VER) && defined(NDEBUG) && defined(WITH_GMP)) || \
228# include "tbb/scalable_allocator.h"
232 return scalable_malloc(size);
236 return scalable_realloc(
ptr, new_size);
261#if defined(__APPLE__)
273#ifdef USE_WIN32_UNICODE_ARGS
281#ifndef WITH_PYTHON_MODULE
285#ifdef USE_WIN32_UNICODE_ARGS
300 setvbuf(stdout,
nullptr, _IONBF, 0);
305# if defined(_MSC_VER)
306 _putenv_s(
"OMP_WAIT_POLICY",
"PASSIVE");
309# ifdef USE_WIN32_UNICODE_ARGS
314 wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc);
315 argv =
static_cast<char **
>(malloc(argc *
sizeof(
char *)));
316 for (argv_num = 0; argv_num < argc; argv_num++) {
322 app_init_data.argv = argv;
323 app_init_data.argv_num = argv_num;
328#if defined(WITH_OPENGL_BACKEND) && BLI_SUBPROCESS_SUPPORT
329 if (
STREQ(argv[0],
"--compilation-subprocess")) {
331 GPU_compilation_subprocess_run(argv[1]);
342 for (i = 0; i < argc; i++) {
343 if (
STR_ELEM(argv[i],
"-d",
"--debug",
"--debug-memory",
"--debug-all")) {
344 printf(
"Switching to fully guarded memory allocator.\n");
348 if (
STR_ELEM(argv[i],
"--",
"-c",
"--command")) {
358 const tm *tm = gmtime(&temp_time);
364 const char *unknown =
"date-unknown";
377#ifdef WITH_PYTHON_MODULE
379 environ = *_NSGetEnviron();
392#elif defined(WITH_CYCLES_LOGGING)
396#if defined(WITH_TBB_MALLOC) && defined(_MSC_VER) && defined(NDEBUG) && defined(WITH_GMP)
402#if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE) && !defined(WITH_HEADLESS)
404 if (argc == 2 &&
STRPREFIX(argv[1],
"-psn_")) {
405 static char firstfilebuf[512];
411 argv[1] = firstfilebuf;
443#ifndef WITH_PYTHON_MODULE
447 app_init_data.
ba = ba;
460 G.factory_startup =
true;
470#ifndef WITH_PYTHON_MODULE
500#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
520#ifndef WITH_PYTHON_MODULE
521 if (
G.background == 0) {
527 WM_init(C, argc, (
const char **)argv);
531 "\n* WARNING * - Blender compiled without Python!\n"
532 "this is not intended for typical usage\n\n");
542#ifndef WITH_PYTHON_MODULE
558#ifndef WITH_PYTHON_MODULE
563#ifdef USE_WIN32_UNICODE_ARGS
568#ifndef WITH_PYTHON_MODULE
576 exit_code =
G.is_break ? EXIT_FAILURE : EXIT_SUCCESS;
599#ifdef WITH_PYTHON_MODULE
600void 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_brush_system_init()
void BKE_cachefiles_init()
void BKE_callback_global_init()
void BKE_cpp_types_init()
General operations, lookup, etc. for materials.
void BKE_materials_init(void)
void BKE_particle_init_rng(void)
void BKE_shaderfx_init(void)
void BKE_sound_init_once(void)
void BKE_sound_force_device(const char *device)
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()
void BLI_kdtree_nd_ free(KDTree *tree)
#define STRNCPY(dst, src)
void BLI_system_backtrace(FILE *fp)
void BLI_task_scheduler_init(void)
void BLI_threadapi_init(void)
void CCL_init_logging(const char *argv0)
void CLG_fatal_fn_set(void(*fatal_fn)(void *file_handle))
void DEG_register_node_types()
blenloader genfile private function prototypes
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 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)
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_use_memleak_detection(bool enabled)
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()
struct ApplicationState::@1407 signal
struct BA_ArgCallback_Deferred * main_arg_deferred
struct ApplicationState::@1408 exit_code_on_error
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)