llpyg: prompt import mod fail; py: fix typo
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// example:
|
||||
// llgoLoadPyModSyms(mod, "name1", &func1, "name2", &func2, NULL)
|
||||
@@ -23,3 +24,30 @@ void llgoLoadPyModSyms(PyObject* mod, ...) {
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*
|
||||
wchar_t* toWcs(const char* str) {
|
||||
size_t len = mbstowcs(NULL, str, 0);
|
||||
wchar_t* wstr = (wchar_t*)malloc((len + 1) * sizeof(wchar_t));
|
||||
mbstowcs(wstr, str, len + 1);
|
||||
return wstr;
|
||||
}
|
||||
|
||||
char* toMbs(const wchar_t* str) {
|
||||
size_t len = wcstombs(NULL, str, 0);
|
||||
char* mstr = (char*)malloc(len + 1);
|
||||
wcstombs(mstr, str, len + 1);
|
||||
return mstr;
|
||||
}
|
||||
|
||||
wchar_t *Py_GetPath();
|
||||
|
||||
void Py_SetPath(const wchar_t* path);
|
||||
void Py_Initialize();
|
||||
|
||||
void llgoPyInitialize() {
|
||||
setenv("PYTHONPATH", "/opt/homebrew/lib/python3.12/site-packages", 1);
|
||||
Py_Initialize();
|
||||
printf("sys.path = %s\n", toMbs(Py_GetPath()));
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user