2

I'm having troubles with dynamically loading a windows shared library with Gambit-C Scheme.

(c-declare "#include <stdlib.h>")
(c-declare "#include <Windows.h>")
(define load-library (c-lambda () void "
    HINSTANCE lib = LoadLibrary (\"test.dll\");
    if (lib) printf (\"works!\");
"))
(load-library)

Directory structure:

--test.scm
--test.dll

GSC commands:

gsc -exe test.scm

I've tested it in pure compiled C and it loads there. Thank you.

Alisa D.
  • 134
  • 6

1 Answers1

1

Try an absolute path. To test things place test.dll in the root of C. If an absolute path works, you know that the problem is related to the environment variable that holds the search path of dynamic libraries.

soegaard
  • 30,661
  • 4
  • 57
  • 106