Qbasicnews.com

Full Version: Troubles with COMMON...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Can someone help me using COMMON? I try this...

the include:
Code:
''Filename: bi.bi
declare sub writebuffer(x%)
common shared buffer() as integer
the main program:
Code:
''Filename: 1.bas
'$include:'bi.bi'
redim buffer(1000)as integer
writebuffer(1)
end
and the module:
Code:
''Filename: 2.bas
'$include:'bi.bi'
sub writebuffer(x%)
  buffer(x%)=1
end sub
i compile it with
Code:
fbc 1.bas 2.bas
It compiles but gives a Windows App error at runtime "Memory can't be written"

What i'm doing wrong? I have read somewhere that all COMMON arrays in FB are DYNAMIC.
Adding $DYNAMIC before the COMMON does'nt solve the problem...

Perhaps it's a bug?
Hmm, yeah, found the problem, descriptor names are different between files, so LD won't "share" both, will fix asap.
Fixed, code is on CVS - takes hours to SF.net show the updates on files when logging as anonymous tho..
Thanks, v1ctor.
I don't know enough about CVS to be able of building a compiler for me, too many files....i'll wait for the next release.
Should I get a CVS utilility?
With TortoiseCVS it's really simple, it installs as an Explorer extension: http://www.tortoisecvs.org

Then right-click on some dir using Explorer and select CVS Checkout...

Configure it as (all fields are case-sensitive):

CVSROOT: :pserver:anonymous@cvs.sourceforge.net:/cvsroot/fbc

Protocol: Password server (:pserver:)

Server: cvs.sourceforge.net

Port: [leave blank]

Repository folder: /cvsroot/fbc

User name: anonymous

Module: compiler

It will create the "compiler" dir and download all source files.

To recompile the compiler, create the "src" dir inside the dir where FB was installed (must be the last version), and copy the "compiler" dir onto it (so path will be "[FB's install path]\src\compiler".

CD to ....\src\compiler and type make (Mingw32 must be installed and its bin dir (where make.exe and ld.are) must be in your PATH env variable).

If things went right, the fbc_new.exe file will be created at same dir where fb.exe is.
Arghh!! Mingw32 must be installed? Does Bloodshed dev-C work the same?
I guess, never tested it.. you only need make.exe and ld.exe from it tho - ld.exe is at fb's distro at the \bin dir.
If you get the Dev-C++ package with mingw included, that'll work fine. Just make sure the PATH env var is set correctly.
Unfortunately it breaks
Code:
C:\ARCHIV~1\FREEBA~1\compiler>c:\Dev-c++\bin\make
..\..\fbc.exe -e -c -d TARGET_WIN32 fbc.bas -o obj/fbc.o
process_begin: CreateProcess((null), ....fbc.exe -e -c -d TARGET_WIN32 fbc.bas -
o obj/fbc.o, ...) failed.
make (e=2): El sistema no puede hallar el archivo especificado.
c:\Dev-c++\bin\make: *** [obj/fbc.o] Error 2
I will wait for the official release. For the COMMON problem I will merge the two files...
Oh yeah, last step.. create the obj dir inside src/compiler (src/compiler/obj).
Pages: 1 2