Subject: Re: Mixing NetBSD and Linux shared libs
To: Paulo Alexandre Pinto Pires <>
From: Jaromir Dolecek <>
List: current-users
Date: 04/18/2002 11:00:28
> Maybe my question will sound too newbie, but is it possible to
> dynamically link native NetBSD shared libraries to a Linux application
> running under emulation without problems?

Not generally, tho it might work in some specific cases. Note that the kernel
doesn't know whether any specific piece of code is 'native' or 'emulation'
code - if it's run in context of Linux binary, it's treated as Linux code. 

1) most of syscalls have different number, so you might end up executing
   different system calls if you use NetBSD libraries linked into Linux ones
2) even when syscalls have same number and the parameters officially match,
   the actual used structures differ; when the code is run under Linux
   emulation (which is the case if it gets linked into Linux binary),
   the structures are filled accordingly to the way the structure is in Linux,
   but the actual library code would expect and use NetBSD layout (since
   it has been compiled for NetBSD)
3) even if you use just library (userland) functions, things might still
   break if any structure or args are different on NetBSD/Linux
   (typical might be int vs. int64_t)

So, with care and if the code doesn't use any operating system specific
structures and syscalls, this could work.[*]


 [*] I think that the XFree binary drivers are made this way, so that they
     are usable on any operating system capable to load them, without
     regard on what particular OS it was compiled on.
Jaromir Dolecek <>
ARTISYS, s.r.o., Stursova 71, 61600 Brno, Czech Republic
phone: +420-5-41224836 / fax: +420-5-41224870 /