On Tue, Nov 28, 2017 at 1:56 PM, wang Yu <yuwang668...@gmail.com> wrote:

> i am fresh man in osv, and i have a question about it;
> if we have some dyminic library .so, i want to how to run?
> for example, a.so have main enter, and it want to call the func_b()
> in b.so(we don't want to recompile it)
> a.c --->a.so
> extern void func_b(void)
> void main(void)
> {
>   ...
>    func_b();
>    ...
> }
>
> b.c--->b.so
> void func_b(void)
> {
>   ....
> }
>
> i have edit  module.py  like this
>
> ```
> from osv.modules import api
>
> default = api.run('/a.so')
> ````
> usr.manifest
> a.so:${MODULE_DIR}/a.so
> b.so:${MODULE_DIR}/b.so
>
> but when running, it can't look func_b()
>

How do you compile a.so? You want b.so to also be loaded when a.so is run,
and you need to say this when you *link* a.so. For example:


     gcc -shared -o a.so -fPIC a.c b.so

Note the b.so at the end of the linking command. It will link b.so into
a.so, which doesn't really do much except record in a.so that it needs to
load b.so as well.
You can see the list of required shared object with the "ldd a.so" command,
and you want to see b.so there.

Finally, if you run OSv with "scripts/run.py", try adding the "-V" command
for more verbose output, and see if there are any warnings on missing
shared objects.



>
> and i have the same question about server jar
> a.jar b.jar c.jar
> a.jar have the main, it depend on b.jar and c.jar
> i use like this cannot find b.jar and c.jar's function
> default = api.run("/java.so -jar a.jar ");
>

You need to use Java's class path option specifying multiple jars.
Just like you would use the "java" command in Linux, for example.

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to