Linux嘚瑟一时的Shared Object
场景概述
近来接触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的更多相关文章
- 解决 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 ...
- 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 ...
- linux 缺少动态连接库.so--cannot open shared object file: No such file or directory
error while loading shared libraries的解決方法 执行行程式時,如此遇到像下列這種錯誤: ./tests: error while loading shared l ...
- 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 ...
- 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 一下,查看系统里是否有该 ...
- 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 ...
- ./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 ...
- libstdc++.so.5: cannot open shared object file: No such file or directory
中文分词一般会选择ICTCLAS的模块,虽然不能说很完美,但也算是一个不错的选择.它提供了windows版本和linux版本,并支持C/C#/JNI接口.这本来是一个不错的事情,但版本一多,官方似乎就 ...
- 错误: libstdc++.so.6: cannot open shared object file: No such file or directory
解压完别人提供的openwrt代码,编译时,出现如下错误: # configuration written to .config#mips-openwrt-linux-uclibc-gcc: erro ...
随机推荐
- 有关Ant编译
今天给一个项目做jar包,从之前的项目拷贝了build文件,改了改,运行,结果有问题.编译时不打出任何信息,也不报错,从目标文件看,似乎拷贝等任务都执行了,但是编译没有执行.网上Google结果都说是 ...
- POJ 1503 Integer Inquiry 简单大数相加
Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his explo ...
- 折腾iPhone的生活——设置“查找我的iPhone”,让iPhone更防盗
对于iPhone,防盗一直是一个非常那啥的话题,很多买过iPhone的人都被偷过,但疼,然而苹果也看到了这个问题,所以在iOS7,我们终于看到了一个比较靠谱的防盗软件:查找我的iPhone 之前小偷解 ...
- MFC图形处理
关于MFC绘图功能入门 创建Dialog based MFC工程 打开Resource view 下的Dialog主界面 添加Picture control控件,为此控件添加CStatic的co ...
- 《Linear Algebra and Its Applications》-chaper6-正交性和最小二乘法- 格拉姆-施密特方法
构造R^n子空间W一组正交基的算法:格拉姆-施密特方法.
- 《University Calculus》-chape12-偏导数-基本概念
偏导数本质上就是一元微分学向多元函数的推广. 关于定义域的开域.闭域的推广: 其实这个定义本质上讲的就是xoy面上阴影区域的最外面的一周,只不过这里用了更加规范的数学语言. 二次函数的图形.层曲线(等 ...
- lightoj1051 Good and Bad (dp)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1051 题目大意:给你一个字符串,只包含大写字母和‘?’,如果字符串中出现了连续三个以上 ...
- OpenCV 中 IplImage、CvMat、Mat中的type是怎么回事?
在使用opencv的过程中,无论使用原始的IplImage和CvMat类型,还是用最新C++版本的Mat类型,在创建和使用过程中,经常会遇到CV_8UC1.CV_8UC3.CV_32FC3等声明,我以 ...
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(45)-工作流设计-设计步骤
原文:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(45)-工作流设计-设计步骤 系列目录 步骤设计很重要,特别是规则的选择. 我这里分为几个规则 1.按自行 ...
- thinkphp 视图模型使用分析
<?php /** * 视图模型 * */ class ViewBatchModel extends ViewModel{ public $viewFields = array( 'Jinxia ...