dexter <nan.n...@outlook.com> added the comment:

for example, there are some of shared libs, all these libs have a function 
named getList() exported. and getList() will return a list of names which also 
as a function name been exported.

shared lib A
export getList() -> return ["aaa", "bbb"]
export aaa()
export bbb();

shared lib A
export getList() -> return ["xyz", "abc", "mno"]
export xyz()
export abc();
export mno();

and I want expose shared lib A aaa, bbb or shared lib B xyz abc mno when I load 
them, (maybe A, maybe B, or maybe both if they exists, work like plugins)

I have a loop like

for (int i = 0; i < length_of_list; ++i) {
    char* funcName = getName(i);
    PyMethodDef def { funcName, fooCall, MATH_VARARGS, nullptr, /* funcname 
here */};
    /// ....
}

PyObject* fooCall(PyObject* self, PyObject* args, void* context) {
    char* funcname = (char*) context;
    /// .... load func based on name.
}

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41895>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to