It was too late in the night when I wrote this email to think clearly: I tried to apply my experiences from embedding C++ code via the ECL FFI on my Mac to Windows... Not a good strategy :)
In both cases I got the same error messages being caused by the compiler misinterpreting the C++ code as C code.
In the case of my Mac recompiling ECL with '--with-cxx' was the solution.
On Windows, however, the problem is caused by 'asdf:make-build' generating a file with the extension .c which makes the compiler interpreting the code as C code. The command line option /TP can be use to force the compiler to interpret the content of the file as C++ code. (See the page "/Tc, /Tp, /TC, /TP (Specify Source File Type)" at http://msdn.microsoft.com/en-us/library/032xwy55.aspx
Doing so a second error is thrown: error C4716: 'main_lib_CUBE' : must return a value ('cube' is the name I called the library). The option /wo4716 can be used to turn it into a warning resulting in the library being built.
(See "/w, /Wn, /WX, /Wall, /wln, /wdn, /wen, /won (Warning Level)" at http://msdn.microsoft.com/en-us/library/thxezb7y.aspx
Here my current solution which builds the library:
In my Makefile:
cube.lib: cube.asd cube.lisp Cube.obj
ecl -norc -load cube-build.lisp
The file with the LISP code used to build the library:
--- cube-build.lisp ---
(push "./" asdf:*central-registry*)
(let ((COMPILER::*cc-flags* (concatenate 'string COMPILER::*cc-flags* " /TP /wo4716 "))
(COMPILER::*ld-bundle-flags* (concatenate 'string COMPILER::*ld-bundle-flags* " Cube.obj ")))
(asdf:make-build :cube :type :static-library :move-here "./cube.lib"))
On the long term a better solution might be
- to add some option to 'asdf:make-build' which takes either ':c' or 'cpp' as value (with ':c' being the derault) and generates a file with the respective extension;
- to change the LISP to C / C++ compiler so that the generated function 'main_lib_NAMEOFLIBRARY' actually returns a value.
Thanks for you help,