ubuntu下的共享库

发布于 2024-08-29 04:49:25 字数 333 浏览 3 评论 0原文

我已经在ubuntu下使用make编译了srp-2.1.2,它创建了一个文件libsrp.a。谁能告诉我如何使用 libsrp.a 作为共享库?我想通过使用 dllimport 在 ubuntu 下的 ac# 文件中使用 libsrp。请告诉我 libsrp.a 文件的含义是什么。

谢谢

,好的,当我使用 nm -D libsrp.a 时 然后我有

c2@ubuntu:~/Desktop/srp-2.1.2/libsrp$ nm -D libsrp.a

t_client.o: nm:t_client.o:没有符号

请告诉我如何获得所有符号。

谢谢

i have compiled srp-2.1.2 under ubuntu using make ,it creat a file libsrp.a. can any one tell me how can i use libsrp.a as shared library?.i want to use libsrp in a c# file under ubuntu by using dllimport.please tell me what is the meaning of libsrp.a file.

thanks

ok when i am using nm -D libsrp.a
then i have

c2@ubuntu:~/Desktop/srp-2.1.2/libsrp$ nm -D libsrp.a

t_client.o:
nm: t_client.o: No symbols

please tell me how i will get all symbols.

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

农村范ル 2024-09-05 04:49:25

libsrp.a 文件是一个静态库;共享库的名称类似于 libsrp.so此处 有一个答案描述了一种从静态库构建共享库的方法(虽然我自己从未这样做过,所以不能保证它有效 - 祝你好运!)

更新:

使用 nm 与 -D 参数要求动态符号(查看 man nm) - 在我链接到该人的问题中使用 -D > 当他在共享库上调用nm时。您的 libsrp.a 是一个静态库,因此要查看符号,您应该这样做

nm libsrp.a

但是,我认为您不需要查看符号来利用解释如何获取符号的答案共享库;如果答案正确,您只需使用正确的参数调用 gcc 即可。我想一旦您获得了共享库,您就可以使用 nm 来查看它是否具有您期望的符号;在这种情况下,您需要-D参数:

nm -D libsrp.so

The libsrp.a file is a static library; a shared library would be called something like libsrp.so. Here there's an answer that describes a way to to build a shared library from a static library (I've never done this myself though, so can't vouch that it works - good luck!)

UPDATE:

Using nm with the -D argument asks for dynamic symbols (check out man nm) - in the question I linked to the guy was using -D as he was invoking nm on a shared library. Your libsrp.a is a static library, so to see the symbols you should just do

nm libsrp.a

However, I don't think you should need to see the symbols to make use of the answer explaining how to get a shared library; if the answer is correct, you should just have to invoke gcc with the correct arguments. I guess once you've got the shared library you could use nm to see if it has the symbols you expect; in that case you will need the -D argument:

nm -D libsrp.so
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文