rename Extension to yaze_extension for global namespace
This commit is contained in:
@@ -6,9 +6,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void* handle = nullptr;
|
void* handle = nullptr;
|
||||||
Extension* extension = nullptr;
|
yaze_extension* extension = nullptr;
|
||||||
|
|
||||||
Extension* GetExtension() { return nullptr; }
|
yaze_extension* GetExtension() { return nullptr; }
|
||||||
|
|
||||||
void LoadCExtension(const char* extensionPath) {
|
void LoadCExtension(const char* extensionPath) {
|
||||||
handle = dlopen(extensionPath, RTLD_LAZY);
|
handle = dlopen(extensionPath, RTLD_LAZY);
|
||||||
@@ -18,8 +18,8 @@ void LoadCExtension(const char* extensionPath) {
|
|||||||
}
|
}
|
||||||
dlerror(); // Clear any existing error
|
dlerror(); // Clear any existing error
|
||||||
|
|
||||||
Extension* (*getExtension)();
|
yaze_extension* (*getExtension)();
|
||||||
getExtension = (Extension * (*)()) dlsym(handle, "getExtension");
|
getExtension = (yaze_extension * (*)()) dlsym(handle, "getExtension");
|
||||||
const char* dlsym_error = dlerror();
|
const char* dlsym_error = dlerror();
|
||||||
if (dlsym_error) {
|
if (dlsym_error) {
|
||||||
std::cerr << "Cannot load symbol 'getExtension': " << dlsym_error
|
std::cerr << "Cannot load symbol 'getExtension': " << dlsym_error
|
||||||
@@ -47,7 +47,8 @@ void LoadPythonExtension(const char* script_path) {
|
|||||||
PyObject* pExtension = PyObject_CallObject(pFunc, nullptr);
|
PyObject* pExtension = PyObject_CallObject(pFunc, nullptr);
|
||||||
if (pExtension) {
|
if (pExtension) {
|
||||||
// Assume the Python extension has the same structure as the C extension
|
// Assume the Python extension has the same structure as the C extension
|
||||||
extension = reinterpret_cast<Extension*>(PyLong_AsVoidPtr(pExtension));
|
extension =
|
||||||
|
reinterpret_cast<yaze_extension*>(PyLong_AsVoidPtr(pExtension));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct Extension {
|
typedef struct yaze_extension {
|
||||||
const char* name;
|
const char* name;
|
||||||
const char* version;
|
const char* version;
|
||||||
|
|
||||||
@@ -17,10 +17,10 @@ typedef struct Extension {
|
|||||||
|
|
||||||
// Function to extend editor functionality
|
// Function to extend editor functionality
|
||||||
void (*extendFunctionality)(void* editorContext);
|
void (*extendFunctionality)(void* editorContext);
|
||||||
} Extension;
|
} yaze_extension;
|
||||||
|
|
||||||
// Function to get the extension instance
|
// Function to get the extension instance
|
||||||
Extension* GetExtension();
|
yaze_extension* GetExtension();
|
||||||
|
|
||||||
void LoadCExtension(const char* extension_path);
|
void LoadCExtension(const char* extension_path);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user