Im使用Eclipse,DDT插件和DMD 2.06作爲編譯器。當我嘗試使用像dlopen這樣的函數時,dlsym usw會在C和GCC中得到「未解決的引用」錯誤,我通過與-ldl,-lsdl usw鏈接來修復它們,但是DMD2編譯器沒有這樣的選項,是還有另一種方式來鏈接特定的圖書館?DMD2(D語言)如何鏈接一個C庫(libdl.so.2)
順便說一句,我定義的C函數如下方式
extern(C)
{
/* From <dlfcn.h>
* See http://www.opengroup.org/onlinepubs/007908799/xsh/dlsym.html
*/
const int RTLD_NOW = 2;
void *dlopen(const(char)* file, int mode);
int dlclose(void* handle);
void *dlsym(void* handle, const(char*) name);
const(char)* dlerror();
}
會高興的任何幫助。
thanks -L-ldl works – 2012-08-13 18:00:02