【问题标题】:Compile Ada sources without the shared libraries在没有共享库的情况下编译 Ada 源
【发布时间】:2013-08-15 22:49:43
【问题描述】:

如何在glibc 环境中从here 编译Hello World 程序并在uclibc 环境中运行它?

localhost:~$ readelf -d /home/localhost/hello | grep NEEDED
0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

【问题讨论】:

    标签: gcc shared-libraries static-libraries ada


    【解决方案1】:

    查看 dlopen() 库函数集。您需要从源文件本身加载库。以下代码是用 C 编写的,但您可以使用 Ada 中的 Interafaces.C 与 C 库进行互操作:

    lib_handle = dlopen("/opt/lib/libctest.so", RTLD_LAZY);
    if (!lib_handle) 
    {
       fprintf(stderr, "%s\n", dlerror());
       exit(1);
    }
    

    访问此link 寻求帮助。这个man page dlopen(3) 也应该有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-25
      • 1970-01-01
      • 2012-10-05
      • 1970-01-01
      • 2011-08-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多