Commit d23dabd8 authored by Shashank Chaudhry's avatar Shashank Chaudhry Committed by Facebook GitHub Bot

Enable CLANGFORMAT

Reviewed By: zertosh

Differential Revision: D31753624

fbshipit-source-id: cebadddc83af19739a0ada00cb4bbfde0d640213
parent 5a48486f
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#define PATH_SIZE 32768 #define PATH_SIZE 32768
...@@ -18,19 +18,27 @@ void add_search_path(const wchar_t* path) { ...@@ -18,19 +18,27 @@ void add_search_path(const wchar_t* path) {
wchar_t** lppPart = NULL; wchar_t** lppPart = NULL;
if (!GetFullPathNameW(path, PATH_SIZE, buffer, lppPart)) { if (!GetFullPathNameW(path, PATH_SIZE, buffer, lppPart)) {
fwprintf(stderr, L"warning: %d unable to expand path %s\n", GetLastError(), path); fwprintf(
stderr,
L"warning: %d unable to expand path %s\n",
GetLastError(),
path);
return; return;
} }
if (!AddDllDirectory(buffer)) { if (!AddDllDirectory(buffer)) {
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error != ERROR_FILE_NOT_FOUND) { if (error != ERROR_FILE_NOT_FOUND) {
fwprintf(stderr, L"warning: %d unable to set DLL search path for %s\n", GetLastError(), path); fwprintf(
stderr,
L"warning: %d unable to set DLL search path for %s\n",
GetLastError(),
path);
} }
} }
} }
int locate_py_main(int argc, wchar_t **argv) { int locate_py_main(int argc, wchar_t** argv) {
/* /*
* We have to dynamically locate Python3.dll because we may be loading a * We have to dynamically locate Python3.dll because we may be loading a
* Python native module while running. If that module is built with a * Python native module while running. If that module is built with a
...@@ -48,11 +56,12 @@ int locate_py_main(int argc, wchar_t **argv) { ...@@ -48,11 +56,12 @@ int locate_py_main(int argc, wchar_t **argv) {
add_search_path(L"C:\\Python37\\"); add_search_path(L"C:\\Python37\\");
add_search_path(L"C:\\Python38\\"); add_search_path(L"C:\\Python38\\");
python_dll = LoadLibraryExW(L"python3.dll", NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); python_dll =
LoadLibraryExW(L"python3.dll", NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
int returncode = 0; int returncode = 0;
if (python_dll != NULL) { if (python_dll != NULL) {
pymain = (Py_Main) GetProcAddress(python_dll, "Py_Main"); pymain = (Py_Main)GetProcAddress(python_dll, "Py_Main");
if (pymain != NULL) { if (pymain != NULL) {
returncode = (pymain)(argc, argv); returncode = (pymain)(argc, argv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment