场景概述

近来接触node程序以及负责实现node扩展来对象本地SDK的调用,旨在借node及其第三方库来快速实现RESTful API以及给浏览器端使用。当然这中间研究工作耗了不少时间。

在实现目标扩展中,因SDK调用存在一些事件状态需要关注且由上层处理,为了便于模型的可视性为了易于理解,因此还是觉得需要把该特性提供到脚本层控制为好。这就需要使用到node的异步通知事件的特性。

对于异步并行设计,node框架是借助了libuv的支持,而扩展程序欲与框架引擎线程交互,于是说扩展还是需要依赖libuv。

问题出现在,我现在编译出来的node启动程序,就一个目标,集成了v8引擎,libuv/c-ares/http_parser这些第三方库于一身。目前也未寻找到方法剥离这些库,当然也想到发布的目标环境是嵌入到板子里运行,如果这些依赖关系是独立的共享库文件,可能发布的总体积会大些。

现在的问题就可以简单的描述说,我需要编译的共享库依赖libuv,而这块功能已经集成在启动目标中。我需要确定这种依赖是否可行,保证扩展可以使用启动程序中的功能。

把问题分解到最细致,就是需要验证这种符号依赖,会不会遇到运行时符号无法解决的问题。

试验

// test symbol depend on the main
// a.out <--> liba.so // need each symbol
// generate lib.so
// gcc -shared -o liba.so test.c -D SO_COMPILE
// generate a.out
// gcc test.c -L ./ -la -Wl,-rpath,./
// run ./a.out #include <stdio.h> void so_call();
void test(); #ifndef SO_COMPILE
void test()
{
printf("%s -from main program\n", __FUNCTION__);
}
int main(int argc, char const *argv[])
{
/* code */
so_call();
return ;
}
#else
void so_call()
{
printf("%s -from shared library\n", __FUNCTION__);
test();
}
#endif//SO_COMPILE

a.out

main -->so_call@liba.so

test

liba.so

so_call -->test@a.out

执行结果

结果正所期望,这说明我们编码的目标,最终的运行过程还是按一些可识别易理解的符号来展开的,而不是一些固态寻址的过程。站在应用的高度来观察问题,总比陷在底层拘泥于代码好很多,哈哈。试想哪个汇编程序员的世界如果不拓展一下自己的见识,又怎知高级语言以及其他技术选择的优雅与便捷呢。

Linux嘚瑟一时的Shared Object的更多相关文章

  1. 解决 Linux error while loading shared libraries: cannot open shared object file: No such file or directory

    安装最新版本Emqtt,参照官方文档安装后,执行报错: Linux error while loading shared libraries libsctp.so.1: cannot open sha ...

  2. Linux缺少动态连接库.so--cannot open shared object file: No such file or directory

    1 Liunx安装报错时,缺少动态链接库时,形式如下: /usr/local/libexec/gcc/x86_64-unknown-liunx-gnu/4.8.2/cc1: error while l ...

  3. linux 缺少动态连接库.so--cannot open shared object file: No such file or directory

    error while loading shared libraries的解決方法  执行行程式時,如此遇到像下列這種錯誤: ./tests: error while loading shared l ...

  4. ImportError: libsybdb.so.5: cannot open shared object file: No such file or directory pymssql linux 问题解决 搭建驱动

    [root@hadoop1 nlp]# python sqlserver_t.py Traceback (most recent call last):  File "sqlserver_t ...

  5. error while loading shared libraries: libXXX.so.x: cannot open shared object file: No such file or directory .

    转载:http://www.eefocus.com/pengwr/blog/2012-02/235057_baf52.html 此时你可以locate libXXX.so.x 一下,查看系统里是否有该 ...

  6. libGraphicsMagickWand.so: cannot open shared object file: No such file or directory stack traceback:

    参考博文:http://www.linuxidc.com/Linux/2016-07/133213.htm ==>> Check Passed, the num of bbox and f ...

  7. ./jad: error while loading shared libraries: libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory

    Ubuntu 上使用jad,出现上面错误: ./jad: error while loading shared libraries: libstdc++-libc6.2-2.so.3: cannot ...

  8. libstdc++.so.5: cannot open shared object file: No such file or directory

    中文分词一般会选择ICTCLAS的模块,虽然不能说很完美,但也算是一个不错的选择.它提供了windows版本和linux版本,并支持C/C#/JNI接口.这本来是一个不错的事情,但版本一多,官方似乎就 ...

  9. 错误: libstdc++.so.6: cannot open shared object file: No such file or directory

    解压完别人提供的openwrt代码,编译时,出现如下错误: # configuration written to .config#mips-openwrt-linux-uclibc-gcc: erro ...

随机推荐

  1. Spark SQL  inferSchema实现原理探微(Python)

    使用Spark SQL的基础是“注册”(Register)若干表,表的一个重要组成部分就是模式,Spark SQL提供两种选项供用户选择:   (1)applySchema     applySche ...

  2. activity跳转关闭软件盘

    之前试过 if(getWindow().getAttributes().softInputMode==WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPE ...

  3. android 自动化(1)

    学习android自动化测试要感谢一个朋友耐心的指导 环境搭建:(需要java JDK 以及android SDK) JDK:http://www.oracle.com/technetwork/jav ...

  4. removeTask

    SystemUI中,Home键调出小刷子杀最近任务,整个流程从其RecentsPanelView.java开始: public void handleSwipe(View view) { ... // ...

  5. unity中的mesh合并

    在分析shadowgun时,无意中发现所有的环境建筑运行后,都被合并成一个叫做 "Combined Mesha (root: scene)" 的mesh了,但是没有发现任何合并的脚 ...

  6. vijosP1471 教主的游乐场

    vijosP1471 教主的游乐场 链接:https://vijos.org/p/1471 [思路] 递推. 首先找到最左边的可以一步跳到后方的L, 那么L之后的点有两种情况:要么a足以跳到后方步数为 ...

  7. Eclipse Code Template 设置自动加注释(转)

    Eclipse Code Template 设置自动加注释 设置注释模板的入口: Window->Preference->Java->Code Style->Code Temp ...

  8. HDU-4041-Eliminate Witches! (11年北京网络赛!!)

    Eliminate Witches! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  9. MySQL 的 read_buffer_size 参数是如何影响写缓冲和写性能的?

    Each thread // that does a sequential scan . The value of this variable should be a multiple of 4KB. ...

  10. LINUX 内核调试基础+编程基础

    http://blog.chinaunix.net/uid-20564848-id-73208.html 内核文档:[root@localhost Documentation]# pwd /usr/s ...