caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Vu Ngoc San <san.vu-ngoc@ujf-grenoble.fr>
To: skaller <skaller@users.sourceforge.net>,
	Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] dynamically finding libraries
Date: Thu, 15 Mar 2007 15:56:23 +0100	[thread overview]
Message-ID: <45F95E97.9010300@ujf-grenoble.fr> (raw)
In-Reply-To: <1173969084.11071.16.camel@rosella.wigram>

skaller a écrit :

> Of course there is a way to do this, but probably you shouldn't.
> Modern Linices usually have package managers, so you should
> just tell the client to install the library.
> 

I like packages, but I like as well the idea of a completely relocatable 
and distribution independent sotfware which could run, for instance, 
from a USB pen-drive.

I first tried to write a script setting LD_LIBRARY_PATH, but I have no 
idea about how to make it work with relative paths and allow symbolic links.

> Otherwise, you can write a C program that tries to call
> a function from the library, and compile, link, and run it,
> and check the result. This is a configuration time check.
> 
> For a run time check, you can call dlopen() and dlsym()
> on the library and a known symbol in the library.
> If you do this, however, you will have to access ALL the
> symbols in the library with dlsym (that is, indirectly).
> 

Darn. No ocaml trick for this ?

> Although Elf does allow load time lazy linkage of symbols,
> so missing symbols don't abort the program until they're
> used, there is no way I know of to have 'maybe' linkage
> of libraries. If your code is linked against a library
> the program will abort if it isn't found at run time,
> and before you get control.
> 
> The best you can do is try to figure out the error code,
> and restart the program in a script that adds 
> the directory containing your version in LD_LIBRARY_PATH.
> 


  parent reply	other threads:[~2007-03-15 14:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15 13:42 Vu Ngoc San
     [not found] ` <1173969084.11071.16.camel@rosella.wigram>
2007-03-15 14:56   ` Vu Ngoc San [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-03-14 22:25 Style and organization of code ian
2007-03-15 13:38 ` dynamically finding libraries Vu Ngoc San
2007-03-15 17:10   ` [Caml-list] " Eric Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45F95E97.9010300@ujf-grenoble.fr \
    --to=san.vu-ngoc@ujf-grenoble.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=skaller@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).