Search found 250 matches

by TeeEmCee
Oct 16, 2017 14:35
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

But that requires actually having a list of module initialisers. The gas backend could do that by embedding metadata in object files which is then read at the linking stage. But to do that in the gcc backend without inspecting the object files (eg for constructor functions which are recognisable by ...
by TeeEmCee
Oct 15, 2017 22:10
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

FBRT0.bas: to write this as pure FB, then would have to add an __attribute__() type feature in to FB. ... But even with C this is non-standard and not completely portable as DJ handles global ctors/dtors in DOS differently than on win/*nix. Quite possible that unknown future targets will be differe...
by TeeEmCee
Oct 15, 2017 11:58
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

What, really? I've never heard of delegating something like that to the kernel on Unix, though I would expect memcpy on Windows to just call the equivalent routine in user32.dll (which is still user-mode, not part of the kernel). It seems crazy to do a syscall for an optimised memcpy, since that add...
by TeeEmCee
Oct 15, 2017 0:36
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

There are several mistakes in your memcpy. > grep "dim.*__fb_ctx" *.bas init.bas:dim __fb_ctx as FB_RTLIB_CTX str_format.bas: dim as FBSTRING ptr dst = @__fb_ctx.null_desc Other functions like fb_hListInit don't exist (grep fb_hListInit *.bas). That's because fbrtLib is mostly incomplete. ...
by TeeEmCee
Oct 14, 2017 13:52
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

Sorry, you can't simply include a couple source files from the library and expect it to work. Those files have dependencies on many other files, and on libc, as you noticed. Quite a lot of the minimum code that needs to be linked is related to initialising the console, actually, so that PRINT can wo...
by TeeEmCee
Oct 14, 2017 0:21
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

Damnit, I forgot to actually add the makefile to git! Sorry about about; I made another pull req for it. There's a lot of stuff in FB's makefile that I left out, in particular most OS-specific stuff, including support for building for DOS. It can be added back later. But I guess actually targetting ...
by TeeEmCee
Oct 13, 2017 13:14
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

OK, I got it to compile and run on linux-x86 after fixing some bugs. Should work on win32 too, if you have the prereqs for compiling libfb itself there (I don't, but aside from that, crosscompiling seemed to work). I copied out some parts of FB's makefile and modified it to prefer .bas files over .c...
by TeeEmCee
Oct 06, 2017 13:59
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

Just to double check: were you only using 'integer' where the original C used 'int'? Or were you also using integer in other places? Because, where 'integer' is used on the FB side (eg in tables of rtlib functions in the compiler), the rtlib uses ssize_t. So I guess you could do a replacement of all...
by TeeEmCee
Oct 05, 2017 3:33
Forum: Community Discussion
Topic: Most important concepts to learn for a new developer (Top 50)
Replies: 34
Views: 2691

Re: Most important concepts to learn for a new developer (Top 50)

Yeah, the QBasic (IIRC QuickBasic was compiled only?) debugging experience was awesome. I'm still trying to figure out how to allow live modfiication of running code at the line-level in my own scripting language. I didn't mean to say that debugging tools are necessary. I often find that using gdb i...
by TeeEmCee
Oct 04, 2017 16:15
Forum: Community Discussion
Topic: Most important concepts to learn for a new developer (Top 50)
Replies: 34
Views: 2691

Re: Most important concepts to learn for a new developer (Top 50)

Learn to break a problem into pieces and to abstract, probably the most important programming skill. You're going to need to read lots of good code, and then a lot of trial and error to learn what a good abstraction layer looks like. Read Joel Spolsky's essay on leaky abstractions! Well, if that isn...
by TeeEmCee
Oct 04, 2017 16:04
Forum: Community Discussion
Topic: Unofficial FreeBASIC 1.04.0 OS X release
Replies: 35
Views: 7075

Re: Unofficial FreeBASIC 1.04.0 OS X release

Yikes, that looks like a serious error; I wonder what's happening there? I fear it's some change in the X11 headers on OSX. I don't have access to my mac at the moment. ld: warning: object file (/usr/local/lib/freebasic/darwin-x86_64/libfb.a(con_input.o)) was built for newer OSX version (10.13) than...
by TeeEmCee
Oct 04, 2017 15:55
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

Point is that va_arg isn't supported by FB on most platforms. I don't know if it's possible to add support, but fbc's todo.txt lists, (for the LLVM backend): - va_*() macros can't be implemented, so must be disallowed just like with -gen gcc This looks bad. As a kludge we could use libffi (or a smal...
by TeeEmCee
Oct 04, 2017 15:45
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

The compiler expects all of fb_StrCompare, fb_WstrCompare, fb_VALINT, fb_WstrValInt, etc. to return long, not integer. I meant examples that return int in C but integer in FB (there shouldn't be any). Note that the compiler might promote the result from the rtlib function to an integer in cases like...
by TeeEmCee
Oct 04, 2017 8:28
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

I have not tried running anything yet. As I said in the first post, I check to see if it will compile. Since almost every part relies on another part, it is hard to find one part I could test without having the whole thing intact. There are two approaches you could follow to test your code before y...
by TeeEmCee
Oct 03, 2017 11:28
Forum: Projects
Topic: Pure FB Runtime Library (in progress)
Replies: 209
Views: 15117

Re: Pure FB Runtime Library (in progress)

Wow, you've done a lot of work already! Have you tried running it at all?

I notice a mistake in the translation: you've been translating 'int' to 'integer', but the equivalent of C's 'int' in FB is 'long'.
Also, you need to wrap everything in Extern "C" if you're not doing that already.

Go to advanced search