---- sltest.c ------------------------------------------------------
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char SLang_init_tty ();
int
main ()
{
return SLang_init_tty ();
;
return 0;
}
--------------------------------------------------------------------
Relevant environment settings:
LIBRARY_PATH=e:/emx/lib;e:/usr/lib;e:/usr/local/lib
C_INCLUDE_PATH=e:/emx/include;e:/usr/include;e:/usr/local/include;e:/usr/local/
include/ncurses;
slang.h and slcurses.h are in e:\usr\local\include and slang.a and slang.lib
are in e:\usr\local\lib.
However, any time I try to compile:
[F:\programming\c]gcc -lslang sltest.c
(...): Undefined symbol _SLang_init_tty referenced from text segment
Am I missing something stupid here?
Using emx+gcc 0.9d-4.
--
Alex Taylor
Fukushima, Japan
http://www.socis.ca/~ataylo00
Please take off hat when replying.
Try gcc sltest.c -lslang
Should really be gcc -Zmt sltest.c -o sltest.o -lslang
or -o sltest.exe.
It is really important with emx to be consistent with using the
multi-thread library or not so if something is built with -Zmt (or
-Zmtd) you need -Zmt in CFLAGS and LDFLAGS or you will get weird runtime
errors. Only time not to use the multi-thread library is if you want to
run your program under DOS.
Dave
> Am I missing something stupid here?
>
> Using emx+gcc 0.9d-4.
There is ABI incompatibility between EMX and K-gcc (different
underscore'ing). Are you sure that slang.a is compiled for EMX?
Check
nm e:\usr\local\lib/slang.a
Yours,
Ilya
I just compiled slang with EMX and checked with nm before answering
Alex's mail. The symbols have an underscore prefix.
As I stated it is just where -lslang appears on the command line.
Dave
> > There is ABI incompatibility between EMX and K-gcc (different
> > underscore'ing). Are you sure that slang.a is compiled for EMX?
>
> I just compiled slang with EMX and checked with nm before answering
> Alex's mail. The symbols have an underscore prefix.
> As I stated it is just where -lslang appears on the command line.
Yeah... I was getting the same error from the autogenerated 'configure'
script though.
In any case, the solution was to both change the position AND add the
-Zmt switch.
Thanks!
(Now I just have to figure out why several object files are kicking up
'Undefined symbol _errno referenced from text segment'.)
Slightly different then me then. I was also getting errors about main()
being multiply defined before moving the -lslang.
>
> Thanks!
>
> (Now I just have to figure out why several object files are kicking up
> 'Undefined symbol _errno referenced from text segment'.)
>
Try adding -D__ST_MT_ERRNO__ and/or -Zsys-signals to CFLAGS and LDFLAGS.
My CFLAGS, CXXFLAGS and LDFLAGS in config.site contain
CFLAGS='-D__EMX__ -DOS2 -Zmtd -D__ST_MT_ERRNO__ -O2 -fomit-frame-pointer
-Zbin-files -Dstrncasecmp=strnicmp -Dstrcasecmp=stricmp'
Dave
> > (Now I just have to figure out why several object files are kicking up
> > 'Undefined symbol _errno referenced from text segment'.)
>
> Try adding -D__ST_MT_ERRNO__ and/or -Zsys-signals to CFLAGS and LDFLAGS.
> My CFLAGS, CXXFLAGS and LDFLAGS in config.site contain
> CFLAGS='-D__EMX__ -DOS2 -Zmtd -D__ST_MT_ERRNO__ -O2 -fomit-frame-pointer
> -Zbin-files -Dstrncasecmp=strnicmp -Dstrcasecmp=stricmp'
I guess you mean '-Zsysv-signals', although, interestingly, if I specify
that then the program hangs forever on startup without ever displaying
the PM GUI (exactly the same as what happens if I increase the default
stack size, as mentioned in another post).
However, just specifying -D__ST_MT_ERRNO__ does allow the program to build.
...unfortunately, it gives a SYS3175 if I try to start with the SLang
interface. I've just given up for now, since the ncurses interface
works fine.