我試圖做類似下面的dlsym /與運行參數
enum types {None, Bool, Short, Char, Integer, Double, Long, Ptr};
int main(int argc, char ** args) {
enum types params[10] = {0};
void* triangle = dlopen("./foo.so", RTLD_LAZY);
void * fun = dlsym(triangle, ars[1]);
<<pseudo code>>
}
哪裏僞代碼是一樣的東西
fun = {}
for param in params:
if param == None:
fun += void
if param == Bool:
fun += Boolean
if param == Integer:
fun += int
...
returnVal = fun.pop()
funSignature = returnval + " " + funName + "(" + Riffle(fun, ",") + ")"
exec funSignature
謝謝
>我想要做下面的事情 那麼當你嘗試這個時會發生什麼? – a2800276 2009-08-30 18:32:24
@ a2800276:編譯器抱怨許多語法問題。更深層的問題是誤解'dlopen()'和'dlsym()'等提供的服務。 – 2009-08-30 19:01:05