[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C module problem

From: gustav
Subject: Re: C module problem
Date: Mon, 28 Feb 2011 10:35:04 -0500 (EST)

> I am trying to write a simple C module for Guile (for the learning
> experience) and I have run into a cryptic error.  I have compiled
> `sdl-guile.c' to `' with the following command.
> gcc -shared -o -fPIC sdl-guile.c `guile-config compile` 
> `sdl-config 
> --cflags`
> I then run `guile' and evaluate
> (load-extension "./" "init_module") and get the 
> following
> output.
> ERROR: In procedure load-extension:
> ERROR: In procedure dynamic-link: file: "./", message: 
> "file not found"

I've seen similar errors in the past, exactly in the same
context. They mostly had to do with Guile unable to find the file,
because you *must* give it a full path. The "load-extension" function
does not seem to understand "./", or other similar UNIXy tricks, e.g.,
"~/", "../", etc.

Here is, for example, what I had to do to make it load in one case:

(define libguile_gsl "/home/gustav/src/Forms/lib/libguile_gsl")
(define libguile_gsl_file (string-join (list libguile_gsl "dll") "." 'infix))
(if (access? libguile_gsl_file (logior R_OK X_OK))
   (load-extension libguile_gsl "init_gsl"))

Another, more universal example:

(define SYSTEM (utsname:sysname (uname)))
 ((equal? SYSTEM "Linux") 
  (define DLIB_EXT ".so")
  (define LIB "/fusion/gpfs/project/photonic/lib/Forms"))
 ((equal? SYSTEM "CYGWIN_NT-6.0-WOW64")
  (define DLIB_EXT ".dll")
  (define LIB (string-append (getenv "HOME") "/src/Forms/lib")))
  (define DLIB_EXT "")
  (define LIB "")))
(load-extension (string-append LIB "/harmonic" DLIB_EXT) "init_signal_lambdas")
(load-extension (string-append LIB "/drude" DLIB_EXT) "init_e_lambda")

Hope this helps,

Zdzislaw (Gustav) Meglicki, Office of the Vice President for Information
Technology, Indiana University, 601 E. Kirkwood Ave., Room 116, 
Bloomington, IN 47405-1223, USA,,
Ph: 812-856-5597 (o), 812-345-3284 (m), Fax: 812-855-3310/812-856-3147,
Skype: zdzislaw.meglicki

reply via email to

[Prev in Thread] Current Thread [Next in Thread]