Hi Igor,

On Thu, Jun 30, 2011 at 11:05 AM, Igor Stasenko <siguctua@gmail.com> wrote:
There are two undefined symbols:

Linking C executable results/StackVM.exe
Creating library file: results/libStackVM.dll.a
CMakeFiles/StackVM.dir/objects.a(gcc3x-interp.c.obj): In function `returnAsThrou
c:/hudson/workspace/StackWin32/cog/src/vm/gcc3x-interp.c:34699: undefined refere
nce to `siglongjmp'
CMakeFiles/StackVM.dir/objects.a(sqWin32Prefs.c.obj): In function `CreatePrefsMe
c:/hudson/workspace/StackWin32/cog/platforms/win32/vm/sqWin32Prefs.c:374: undefi
ned reference to `recordPrimTraceFunc'

You need to generate the following defines at the start of interpreter C file. See e.g. gcc3x-cointerp.c.

 * Define sigsetjmp and siglongjmp to be the most minimal setjmp/longjmp available on the platform.
#if WIN32
# define sigsetjmp(jb,ssmf) setjmp(jb)
# define siglongjmp(jb,v) longjmp(jb,v)
# define sigsetjmp(jb,ssmf) _setjmp(jb)
# define siglongjmp(jb,v) _longjmp(jb,v)

In Cog setjmp is used a lot to jump form machine code back into the interpreter, so choosing the most minimal setjmp/longjmp is important.  Alas both Win32 and Unix have their own different ideas as to what a minimal setjmp/longjmp is (see sigsetjmp(3) on unix).  In my VMMaker the defines are generated in CoInterpreter class>>preambleCCode and NewspeakInterpreter class>preambleCCode.  Looks like the CoInterpreter one needs moving up to StackInterpreter right?

 - siglongjmp
(it is found however in cointerp.c so JIT-flavored VMs don't have this
problem, but not stack ones)

The recordPrimTraceFunc() are used like following:

extern sqInt recordPrimTraceFunc();
   if (recordPrimTraceFunc())
              TEXT("Dump recent primitives"));

again, it is defined in cogit.h/.c but obviously not in stack
interpreter, since stack not using cogit.

Maybe you meant
Then it makes sense.

Best regards,
Igor Stasenko AKA sig.