unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Aidan Gauland <aidalgol@no8wireless.co.nz>
To: guile-user@gnu.org
Subject: C module problem
Date: Mon, 28 Feb 2011 21:13:27 +1300	[thread overview]
Message-ID: <20110228081326.GA25446@neko> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 713 bytes --]

Hello,

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 `sdl-guile.so' with the following command.

gcc -shared -o sdl-guile.so -fPIC sdl-guile.c `guile-config compile` `sdl-config --cflags`

I then run `guile' and evaluate
(load-extension "./sdl-guile.so" "init_module") and get the following
output.

ERROR: In procedure load-extension:
ERROR: In procedure dynamic-link: file: "./sdl-guile.so", message: "file not found"

I can follow the example in section 6.20.3 C Extensions of the manual
with no trouble, so I think I am not properly linking to SDL.

Can anyone help me with this?

Regards,
Aidan Gauland

[-- Attachment #1.2: sdl-guile.c --]
[-- Type: text/x-csrc, Size: 669 bytes --]

#include <libguile.h>
#include "SDL.h"

void init_video();

void init_module()
{
	/* Initialize SDL. */
	if (SDL_Init(SDL_INIT_VIDEO) != 0) {
		fprintf(stderr, "SDL initialization error: %s\n", SDL_GetError());
		exit(EXIT_FAILURE);
	}
	/* SDL_Quit should be called when the program finishes. */	
	atexit(SDL_Quit);

	/* Register guile procedures. */
	scm_c_define_gsubr("init-video", 0, 0, 0, init_video);
}

void init_video()
{
	/* Set up video. */
	SDL_Surface *screen;
	screen = SDL_SetVideoMode(640, 480, 24, SDL_HWSURFACE);
	if (screen == NULL) {
		fprintf(stderr, "SDL video error: %s\n", SDL_GetError());
		exit(EXIT_FAILURE);
	}
}

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2011-02-28  8:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28  8:13 Aidan Gauland [this message]
2011-02-28  8:54 ` C module problem nalaginrut
2011-02-28  9:32   ` Aidan Gauland
2011-02-28 21:37 ` Andy Wingo
2011-02-28 23:23   ` Aidan Gauland
  -- strict thread matches above, loose matches on Subject: below --
2011-02-28  9:40 nalaginrut
2011-02-28 10:16 ` rm
2011-02-28 14:54 Mike Gran
2011-02-28 15:35 ` gustav
2011-02-28 17:30 ` dsmich
2011-02-28 18:24   ` Aidan Gauland
2011-02-28 20:43     ` Aidan Gauland

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=20110228081326.GA25446@neko \
    --to=aidalgol@no8wireless.co.nz \
    --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).