@aurelB
I tested it with Codeblocks+MinGW, but since CB supports other compilers, it may also work with others.
@cybermonkey
I only tested on windows, but I think it's only a matter of changing
SYSTEM = SYSTEM_WINDOWS
to
SYSTEM = SYSTEM_UNIX
in src/Makefile and src/plugins/Makefile
PSnake
Nope that's not all because it refers to an "external" library
YABASIC_LIBS = -Lexternal/lib/ -lm -ldl
which results in compile errors:
gcc -o ../bin/yabasic function.o io.o main.o parse.o plugin.o scan.o symbol.o -Lexternal/lib/ -lm -ldl -std=c99 -Wall -Wextra -pedantic -g -DSYSTEM_WINDOWS
plugin.o: In function `ybp_load_plugin':
/home/markus/Downloads/yabasic/src/plugin.c:37: undefined reference to `dlopen'
/home/markus/Downloads/yabasic/src/plugin.c:39: undefined reference to `dlerror'
/home/markus/Downloads/yabasic/src/plugin.c:47: undefined reference to `dlsym'
/home/markus/Downloads/yabasic/src/plugin.c:49: undefined reference to `dlerror'
/home/markus/Downloads/yabasic/src/plugin.c:54: undefined reference to `dlsym'
/home/markus/Downloads/yabasic/src/plugin.c:56: undefined reference to `dlerror'
plugin.o: In function `ybp_load_cfunction':
/home/markus/Downloads/yabasic/src/plugin.c:98: undefined reference to `dlsym'
collect2: ld returned 1 exit status
Instead I have to do this in the Makefile:
YABASIC_LIBS = -lm -ldl
Ok, that's an easy task but imagine someone don't know? I first startled and though, uh oh it doesn't build anymore on Linux until I remembered that Windows needs the "external" shipped libs.
Sorry, this only compiles yabasic but NOT the plugin! This happens when trying to compile the plugin
markus@desktop:~/Downloads/yabasic_neu/src/plugins$ make build
gcc -std=c99 -shared -O2 -Wall -Wextra -pedantic -g -DSYSTEM_UNIX -I. testdrive/testdrive.c ybp_interface.c -o testdrive.ybp
/usr/bin/ld: /tmp/ccWr92ak.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/tmp/ccWr92ak.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Seems I will have to recompile ybasic with -fPIC (64bit issue?)
Okay, this is what I've done: I added -fPIC in the makefiles in src/plugins AND src
Result:
gcc -std=c99 -shared -O2 -Wall -Wextra -pedantic -g -fPIC -DSYSTEM_UNIX -I. testdrive/testdrive.c ybp_interface.c -o testdrive.ybp
mv *.ybp ../../bin/plugins/