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
#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: signature.asc
Description: Digital signature

Reply via email to