On Thu, Jun 27, 2013 at 10:55 PM, Faré <fahree@gmail.com> wrote:
I'd like to add a test in test-bundle.script.
I tried this:

  (operate 'dll-op :test-asdf/bundle-2)
  (si:load-foreign-module (first (output-files 'dll-op :test-asdf/bundle-2)))

  (ffi:def-function "init_dll_BUNDLE_2" () :returning :void)
  (init-dll-BUNDLE-2)

But the function call fails, because it the test script is
interpreted, not compiled.
How do I call the initialization function from the interpreter?

The initialization function cannot be directly called, so I would rather recommend the following solution. First, file2.lisp is changed as below. Then, instead of calling a function, we verify that the library is available by serching for a symbol

(si::find-foreign-symbol "sample_function" "name-of-dll" :pointer-void 0)

---- file2.lisp ----
#+ecl
(ffi:clines "
extern int sample_function();

int sample_function()
{
return 0;
}
")



--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://quinfog.iff.csic.es