flat assembler
Message board for the users of flat assembler.
Index
> Linux > Best DLL import practice? |
Author |
|
f0dder 20 Sep 2012, 19:33
Good question.
I would suspect libname.so.{majorversion} (I suppose) symlinked to libname.so.{majorversion}.{minorversion} - at least that has been the layout of /lib on the distros where I've bothered to look |
|||
20 Sep 2012, 19:33 |
|
JohnFound 20 Sep 2012, 21:52
Ah, I missed this major - minor particularity.
So, the major version is important, right? |
|||
20 Sep 2012, 21:52 |
|
randall 20 Sep 2012, 21:57
The best way in my opinion is to use dlsym, dlopen.
Only external symbol you need is dlsym. Then you can get dlopen like this: dlopen = dlsym(0, "dlopen") From there you can load any shared library. With this approach you can first try to load libname.so.x.y and if it is not found you can load libname.so.x I have simple OpenGL 4.2 program which works like this if you want an example. |
|||
20 Sep 2012, 21:57 |
|
JohnFound 21 Sep 2012, 05:10
randall, I am talking about static import tables. Importing in runtime has its advantages sometimes, but it is "special case" IMHO.
|
|||
21 Sep 2012, 05:10 |
|
randall 21 Sep 2012, 08:15
JohnFound wrote: randall, I am talking about static import tables. Importing in runtime has its advantages sometimes, but it is "special case" IMHO. Yes I know you are talking about static import tables. I just encourage you to consider this approach. It is more flexible, faster and executable file is smaller. |
|||
21 Sep 2012, 08:15 |
|
JohnFound 21 Sep 2012, 08:45
randall wrote: It is more flexible, faster and executable file is smaller. Hm, I am not sure at all. Any arguments? You still need to keep list with imported functions in your executable. _________________ Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9 |
|||
21 Sep 2012, 08:45 |
|
randall 21 Sep 2012, 09:16
JohnFound wrote:
You need to store only name and pointer per function in your executable. Static import table stores a lot more. Also this is interesting read: http://timothylottes.blogspot.com/2012/07/dynamic-linking-and-run-time-recompile.html |
|||
21 Sep 2012, 09:16 |
|
JohnFound 21 Sep 2012, 10:25
Randall, this idea is not so bad actually. I need to think more about it. It even seems to be more portable, because the same "simple import tables" can be used on Windows, Linux and even on OSes that have no dynamic linker at all.
BTW, where this "dlsym" function is located? |
|||
21 Sep 2012, 10:25 |
|
randall 21 Sep 2012, 11:09
dlsym is located in libdl.so.2
|
|||
21 Sep 2012, 11:09 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.