I have looked for some info on this and haven't found anything very helpful.
Background
What I have is GNU Common Lisp installed. I can create a Lisp file and compile it to a .o object file using the command:
gcl -compile <my lisp filename>
Once I have that .o file I use the command (using MinGW):
g++ -o myProgram.exe temp.o temp.cpp
My Lisp file works in GCL. My temp.cpp file is:
//function from (defun fib (x) ...) in lisp file
extern int fib(int);
#include <iostream>
int main()
{
int val;
std::cout << "Print Fibonacci numbers" << std::endl;
std::cout << ">";
std::cin >> val;
while (val != -1)
{
std::cout << fib(val) << std::endl << std::endl;
std::cout << ">";
std::cin >> val;
}
return 0;
}
The errors I get when compiling are this:
temp.cpp:(.text+0x180): undefined reference to `fib(int)'
temp.o:temp.c:(.text+0xb): undefined reference to `vs_base'
temp.o:temp.c:(.text+0x17): undefined reference to `vs_limit'
temp.o:temp.c:(.text+0x1d): undefined reference to `vs_top'
temp.o:temp.c:(.text+0x2d): undefined reference to `small_fixnum_table'
...
The errors are a lot longer and it looks like all the functions defined in GCL.
My Question
So, finally my question. Is what I am trying to do possible? Do I somehow need to include the entire GCL library with a program if I plan on linking it with a C++ program?