rename Extension to yaze_extension for global namespace

This commit is contained in:
scawful
2024-08-08 13:46:50 -04:00
parent 7379a8535c
commit aa5582c434
2 changed files with 9 additions and 8 deletions

View File

@@ -6,9 +6,9 @@
#include <iostream>
void* handle = nullptr;
Extension* extension = nullptr;
yaze_extension* extension = nullptr;
Extension* GetExtension() { return nullptr; }
yaze_extension* GetExtension() { return nullptr; }
void LoadCExtension(const char* extensionPath) {
handle = dlopen(extensionPath, RTLD_LAZY);
@@ -18,8 +18,8 @@ void LoadCExtension(const char* extensionPath) {
}
dlerror(); // Clear any existing error
Extension* (*getExtension)();
getExtension = (Extension * (*)()) dlsym(handle, "getExtension");
yaze_extension* (*getExtension)();
getExtension = (yaze_extension * (*)()) dlsym(handle, "getExtension");
const char* dlsym_error = dlerror();
if (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);
if (pExtension) {
// 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));
}
}
}

View File

@@ -5,7 +5,7 @@
extern "C" {
#endif
typedef struct Extension {
typedef struct yaze_extension {
const char* name;
const char* version;
@@ -17,10 +17,10 @@ typedef struct Extension {
// Function to extend editor functionality
void (*extendFunctionality)(void* editorContext);
} Extension;
} yaze_extension;
// Function to get the extension instance
Extension* GetExtension();
yaze_extension* GetExtension();
void LoadCExtension(const char* extension_path);