unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Jeff Mickey <j@codemac.net>
To: guile-user@gnu.org
Subject: dynamic-link on libc
Date: Fri, 04 Aug 2017 14:15:46 -0700	[thread overview]
Message-ID: <q88zh8xn2fwd.fsf@codemac.net> (raw)

Hi guilers!

I cannot seem to call `dynamic-link' on libc.

I'm trying to write a simple, dumb wrapper around syslog using the 
(system foreign) dynamic library to learn how to use the dynamic 
ffi.

(use-modules (system foreign))
 
(define libcsyslog (dynamic-link "libc"))  (define syslog 
  (let ((f (pointer->procedure 
	    void (dynamic-func "syslog" libcsyslog) (list int 
	    '*)))) 
    (lambda (level msg) 
      (let* ((clevel level) 
	     (cmsg (string->pointer msg))) (f clevel cmsg))))) 
	(syslog 3 "hello there") 


This works when I symlink /lib/x86_64-linux-gnu/libc.so.6 to 
libc.so, but it looks like the libtool library that is doing the 
load doesn't accept names that end in ".6" as a library name, and 
when I used the full path it just says "file not found".

Anyone have suggestions? I looked at the dynl.c sysdep_dynl_link 
function, but I'm not sure I understand libtool well enough to 
know what lt_dlopenext should be doing.

I should add I tested this on a debian system with a debian 
provided guile, and a "user installed guix" guile install as well.

Thanks!

  //  codemac



             reply	other threads:[~2017-08-04 21:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 21:15 Jeff Mickey [this message]
2017-08-04 21:44 ` dynamic-link on libc Matt Wette
2017-08-04 22:12   ` Jeff Mickey

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=q88zh8xn2fwd.fsf@codemac.net \
    --to=j@codemac.net \
    --cc=guile-user@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).