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
ghCallbackContext':
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
nu':
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)
#else
# define sigsetjmp(jb,ssmf) _setjmp(jb)
# define siglongjmp(jb,v) _longjmp(jb,v)
#endif 


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:

#if STACKVM
extern sqInt recordPrimTraceFunc();
#endif
...
#if STACKVM
   if (recordPrimTraceFunc())
     AppendMenu(hMenu, MF_STRING | MF_UNCHECKED, ID_DUMPPRIMLOG,
              TEXT("Dump recent primitives"));
#endif


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

Maybe you meant
#if !STACKVM
?
Then it makes sense.

--
Best regards,
Igor Stasenko AKA sig.




--
best,
Eliot