basicprogramming.org


Welcome, Guest. Please login or register.
Did you miss your activation email?
Forum time; Jul 31. 2010, 02:17
Home Help Search Calendar Login Register
News: Have you got suggestions for BasicProgramming.org? Let's hear them!
Interested in creating your own programming language? Check out the QDepartment group!

+  BASIC programming forum
|-+  Interpreter Development
| |-+  yaBasic development forum. (Moderator: Thomas Larsen)
| | |-+  [WIP] Yabasic 2.9.9 (structures and plugins merged)
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 Go Down Reply Print
Author Topic: [WIP] Yabasic 2.9.9 (structures and plugins merged)  (Read 369 times)
psnake
Sr. Member
****
Offline Offline

Posts: 438



« on: Jan 18. 2010, 12:51 » Reply with quote

This release is the merge of my work on plugins (2.9.7) and Thomas work on structures (2.9.Cool. There's nothing actually new.

Also, regarding the build system, Windows users that want to compile yabasic now have the project files for codeblocks. I'll write a blog post regarding those later this week.

Source: http://basicprogramming.org/main/files/yabasic-src-beta-2.9.9.zip
Windows Binary: http://basicprogramming.org/main/files/yabasic-bin-beta-2.9.9-windows.zip

EDIT: it's a WIP because Thomas has not yet reviewed the code.

EDIT2: like cybermonkey noticed, the Makefiles only work on Windows. I'll try to fix this as soon as possible.

Best Regards,
PSnake

Off-topic: I finally have a new PC and with it Windows 7 and it will be my main platform for development. I just wanted to give a big thanks for all that helped me before I had Windows.
« Last Edit: Jan 18. 2010, 15:05 by psnake » Report to moderator   Logged

twitter: @PSnake89
aurelB
Hero Member
*****
Online Online

Posts: 663



WWW
« Reply #1 on: Jan 18. 2010, 13:40 » Reply with quote

Hi psnake ...
So i need CodeBlocks editor with MingW ?
And then i can compile YaBasic src to final exe?
Report to moderator   Logged

Cybermonkey
Global Moderator
Hero Member
*****
Offline Offline

Posts: 930



WWW
« Reply #2 on: Jan 18. 2010, 13:56 » Reply with quote

Ok, looks fine, but the makefile is now Windows-only  Huh
(Had to adjust several lines in the makefile to compile under Linux)
Report to moderator   Logged

Best wishes,
Cybermonkey
psnake
Sr. Member
****
Offline Offline

Posts: 438



« Reply #3 on: Jan 18. 2010, 14:11 » Reply with quote

@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
Code:
SYSTEM = SYSTEM_WINDOWS
to
Code:
SYSTEM = SYSTEM_UNIX
in src/Makefile and src/plugins/Makefile

PSnake
Report to moderator   Logged

twitter: @PSnake89
Cybermonkey
Global Moderator
Hero Member
*****
Offline Offline

Posts: 930



WWW
« Reply #4 on: Jan 18. 2010, 15:01 » Reply with quote

@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
Code:
SYSTEM = SYSTEM_WINDOWS
to
Code:
SYSTEM = SYSTEM_UNIX
in src/Makefile and src/plugins/Makefile

PSnake
Nope that's not all because it refers to an "external" library
Code:
YABASIC_LIBS = -Lexternal/lib/ -lm -ldl
which results in compile errors:
Code:
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:
Code:
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
Code:
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:
Code:
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/
« Last Edit: Jan 18. 2010, 15:05 by Cybermonkey » Report to moderator   Logged

Best wishes,
Cybermonkey
psnake
Sr. Member
****
Offline Offline

Posts: 438



« Reply #5 on: Jan 18. 2010, 15:04 » Reply with quote

Ok, thanks, I'll mark this one as Windows-only for now, until I rewrite the Makefiles.

PSnake
Report to moderator   Logged

twitter: @PSnake89
Cybermonkey
Global Moderator
Hero Member
*****
Offline Offline

Posts: 930



WWW
« Reply #6 on: Jan 18. 2010, 15:41 » Reply with quote

Sorry for making things more complicated than they are. Of course a plugin is not meant to be a stand-alone programm.  Roll Eyes Unfortunately an example is missing in this WIP ... Tried the one of 297 ... but it didn't work.
Report to moderator   Logged

Best wishes,
Cybermonkey
psnake
Sr. Member
****
Offline Offline

Posts: 438



« Reply #7 on: Jan 18. 2010, 15:54 » Reply with quote

The example was moved to the tests directory (tests/plugin.yab). if it doesn't print anything then it works fine.

PSnake
Report to moderator   Logged

twitter: @PSnake89
aurelB
Hero Member
*****
Online Online

Posts: 663



WWW
« Reply #8 on: Jan 18. 2010, 17:07 » Reply with quote

No problem i have Codeblocks+minGW Wink
I will try...
Report to moderator   Logged

psnake
Sr. Member
****
Offline Offline

Posts: 438



« Reply #9 on: Jan 18. 2010, 17:42 » Reply with quote

I uploaded a new package. The only changes are: src/Makefile and src/plugins/Makefile
If you are on Linux (or other *NIX) you have to comment SYSTEM_WINDOWS and uncomment SYSTEM_UNIX.

About the 64bit issue I'm currently not able to check this. Everything is fine on 32bit Linux and Windows (at least on my machine Wink)

PSnake
Report to moderator   Logged

twitter: @PSnake89
Cybermonkey
Global Moderator
Hero Member
*****
Offline Offline

Posts: 930



WWW
« Reply #10 on: Jan 19. 2010, 09:34 » Reply with quote

The example was moved to the tests directory (tests/plugin.yab). if it doesn't print anything then it works fine.

PSnake
Don't know for sure (I am at my shop now), but it says something like "unknown command 9" or so ...
Report to moderator   Logged

Best wishes,
Cybermonkey
psnake
Sr. Member
****
Offline Offline

Posts: 438



« Reply #11 on: Jan 19. 2010, 09:44 » Reply with quote

Oops, must have uploaded an older version of the code when changed Makefiles. Embarrassed
The problem was in a internal command not being implemented when I merged both 2.9.7 and 2.9.8.

I'll upload it again.

EDIT:
link: http://basicprogramming.org/main/files/yabasic-snapshot-2.9.9.zip
This package is a little bigger because it's a direct snapshot of my work right now and so it includes some unnecessary clutter.

PSnake
« Last Edit: Jan 19. 2010, 09:49 by psnake » Report to moderator   Logged

twitter: @PSnake89
Cybermonkey
Global Moderator
Hero Member
*****
Offline Offline

Posts: 930



WWW
« Reply #12 on: Jan 19. 2010, 12:38 » Reply with quote

Okay, now it works fine. But, please, please add the -fPIC to the Makefile under src/plugins. This also works with 32bit operating systems and makes IMHO no difference but this is the only way to compile on 64bit Linux.
BTW, does the SDL plugin work under Windows?
Report to moderator   Logged

Best wishes,
Cybermonkey
psnake
Sr. Member
****
Offline Offline

Posts: 438



« Reply #13 on: Jan 19. 2010, 13:42 » Reply with quote

Yes, although it's not finished yet.

About the -fPIC I'll add it as soon I get the chance. That flag is only needed on the plugins or the yabasic Makefile needs it too?

PSnake
Report to moderator   Logged

twitter: @PSnake89
Cybermonkey
Global Moderator
Hero Member
*****
Offline Offline

Posts: 930



WWW
« Reply #14 on: Jan 19. 2010, 14:28 » Reply with quote

The flag is only needed on the plugins.
But I tried now the graphics lib on Windows Vista (yabasic main.yab, correct?) and it failed. Something like "Yabasic doesn't work properly" and "Close the program", "Search for solution online" etc. (Don't know the proper English names since I have a German Windows). And SDL.dll is installed, btw.
Report to moderator   Logged

Best wishes,
Cybermonkey
Pages: [1] 2 Go Up Reply Print 
« previous next »
Jump to:  
Atom RDF RSS 0.91 RSS 2.0


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!