TOPIC: Compiling just the language(no UI) under Unix
#908
Compiling just the language(no UI) under Unix 3 Years, 2 Months ago
This is a very general question!

How difficult would you reckon it would be to compile just the language part of Suneido in a Unixish environment (None of the UI/IDE components), so that it runs natively.

I haven't looked at the Suneido code as I have only a fleeting knowledge of C++ but assume that as long as the UI parts of Suneido can be taken out it can then be compile and run as a standalone language under Unix.

Not being a software developer, I reckon this should all take 10 maybe 20 minutes just before lunch on a wet Wednesday afternoon in May. But I have been wrong before.

Is it possible, if so what type of problems might be encountered? (Has anybody tried before?).

Regards,
Chris
 
 
#909
Re:Compiling just the language(no UI) under Unix 3 Years, 2 Months ago
Hi Chris,

There is actually very little UI built in to the exe. Basically the exe provides a DLL interface which stdlib uses to access the Windows GUI. There are a few message boxes and dialogs built in, but these are minor.

The bulk of the C++ code is pretty portable. I regularly build and test with GCC (using MinGW) so compiling shouldn't be an issue.

The memory management / garbage collection used to be more system dependent, but the Boehm stuff I switched to is portable to *nix.

BUT, the server uses Windows "fibers". These are lightweight threads that do NOT preemptively switch tasks. Because task switching is done under the program's control, this avoids all locking issues and all the subtle problems they can lead to. (This was the reason for doing it this way.) It might be possible to emulate fibers with threads, but the ideal "solution" is to change to real threads, which would also allow taking advantage of multiple cores/cpus, which Suneido currently does not do. But this is a fairly big and tricky job.

So, yes, it wouldn't be too hard to build a *nix version of Suneido without UI and without server capabilities. (but still with the built-in database). It wouldn't be a 20 minute job but a day or two would probably suffice (for someone familiar with the code). I'm just not sure how useful the end result would be.

Another option is to run Suneido under Wine. I haven't tried this recently, but last time I checked it worked fairly well. (and seems to get better with each version of Wine)
 
 
andrew
 
#916
Re:Compiling just the language(no UI) under Unix 3 Years, 2 Months ago
I would be interested in doing this for a few reasons mainly educational.

Get familiar with the internals of Suneido, get a better understanding of C++.
I tend to play a lot with console/embedded installations of OpenBSD and thought it would be nice to have Suneido available to me in those environments.

It sounds more approachable than I actually though it might be. If I take this any further I'll be sure to let you know.

Thks for the reply.
Chris
 
 
#917
Re:Compiling just the language(no UI) under Unix 3 Years, 2 Months ago
Sounds good, if you decide to tackle it I'll be happy to try to answer any questions that come up.
 
 
andrew
 
#922
Re:Compiling just the language(no UI) under Unix 3 Years, 2 Months ago
andrew wrote:
]...]
Another option is to run Suneido under Wine. I haven't tried this recently, but last time I checked it worked fairly well. (and seems to get better with each version of Wine)
I have tried recently (on Ubuntu 7.04) but it doesn't work, at least with latest Suneido releases. I think it's the Bohem garbage collector that is not working well with Wine. If this is the case, could you release a Suneido version with a very simple garbage collector (maybe the old gc that you used in the past, that worked under Linux), only to testing Suneido under Linux?
 
 
Mauro
 
#925
Re:Compiling just the language(no UI) under Unix 3 Years, 1 Month ago
I am sorry to hear Suneido no longer works under Wine.

I am not sure how hard it would be to put back the old garbage collector.

It would be fairly easy to disable the garbage collector to see if it was the problem.
 
 
andrew
 
#926
Re:Compiling just the language(no UI) under Unix 3 Years, 1 Month ago
andrew wrote:
I am sorry to hear Suneido no longer works under Wine.

I am not sure how hard it would be to put back the old garbage collector.

It would be fairly easy to disable the garbage collector to see if it was the problem.
How can I disable the garbage collector?
 
 
Mauro
 
#927
Re:Compiling just the language(no UI) under Unix 3 Years, 1 Month ago
This would require changing the C++ code and rebuilding suneido.exe

The main change would be to bmalloc.cpp - this would have to be changed to call malloc instead of GC_malloc

This will revert almost all allocation to the normal C++ allocation (no garbage collection)

However, I notice that there are a few places that call the garbage collector directly - search for "GC_". GC_malloc_atomic can be replaced by malloc, GC_realloc by realloc. There is no equivalent to GC_base used by finalize, but without garbage collection, finalize won't be called.
 
 
andrew
 
#933
Re:Compiling just the language(no UI) under Unix 3 Years, 1 Month ago
I have tried but then Suneido gives to me many errors when I run it (after compiling with GC_malloc replaced by malloc). I think there are many places when I should replace the GC_ functions, but I'm not able to find them all.
 
 
Mauro
 
#934
Re:Compiling just the language(no UI) under Unix 3 Years, 1 Month ago
What are the errors?

Did you grep for GC_ ? I think that should find everything, but maybe I am forgetting some things.
 
 
andrew