Page 2 of 3

Posted: Sun Oct 17, 2004 1:30 pm
by Dare2
Hi Max.²

Thanks for the link. It also handles net (clr), it seems.

Posted: Sun Oct 17, 2004 9:19 pm
by thefool
@tinman: thanks for the link :) ill download it tomorrow

@dare2: hehe yes there is a pretty big difference :D

Posted: Sun Oct 17, 2004 11:39 pm
by Moonshine
Max.²: Ive downloaded that already (despite having no C/C++ knowledge) but is it all based on the .net framework or what?

Posted: Sun Oct 17, 2004 11:45 pm
by Max.²
Moonshine wrote:Max.²: Ive downloaded that already (despite having no C/C++ knowledge) but is it all based on the .net framework or what?
What do you mean with "based on..."?

You can compile also regular C and C++ sourcecodes and can run the compiled stuff on computers with no framework installed or even create PB Userlibs with it, if that is what you mean.

I used this batch for example to make a PB lib:

Code: Select all

cl  -W1 -Gz -Ze /O2 /Ox /J /G7 /arch:SSE2 /Fosourcecode.obj /c sourcecode.c
pause
c:\programme\PellesC\bin\polib /machine:ix86 sourcecode.obj another.obj -out:Lib\purebasic.lib
pause

Posted: Sun Oct 17, 2004 11:46 pm
by Codemonger
This is great to, the beta express 2005 editions. I find lots of bugs, but they are usually for fancy features that I couldn't care less about. The meat and potatoes are there, and they are solid.

http://lab.msdn.microsoft.com/express/

Posted: Mon Oct 18, 2004 1:54 pm
by Moonshine
Max.²: Yes thats what I meant, cheers :)

Posted: Mon Oct 18, 2004 3:50 pm
by Dare2
Tyros first take on C/C++:
  • 1: Confusing
    2: Verbose
    3: File diahoerrea
    4: Dangerous (stability)
    5: Dangerous (security)
    6: Dangerous (sanity)
    7: Unnecessary
    8: Not portable
    9: Unfriendly
    10: See 1
Grief. 8O

Posted: Mon Oct 18, 2004 6:04 pm
by Moonshine
Ten more reasons to love PB :lol:

Posted: Mon Oct 18, 2004 10:25 pm
by GedB
You really should give Eiffel a try.

Posted: Tue Oct 19, 2004 7:19 pm
by fsw
After using PB with his small footprint and trying out some C/C++ compilers with 50+ meg of footprints, I fell in love with 'Sphinx C--'.

It's small, compiles to exe, com, sys, obj and you can mix asm as you wish, every where in your code.

The only downside is, it's Windows only.

But free.

Posted: Tue Oct 19, 2004 7:42 pm
by thefool
50+ megs footprint??
i made a 3 kb hello world with devc++

but ill try the c--. how are the syntax?

Posted: Tue Oct 19, 2004 8:24 pm
by fsw
thefool wrote:50+ megs footprint??
i made a 3 kb hello world with devc++
Sorry if I did confuse you but I ment the footprint of the compiler & libs... 8O

Here some example code:

Code: Select all

// minimal.c--
// Tested on Win2000 
// Compiled with Sphinx C-- Compiler Version 0.239c b4 Feb 10 2003 
//
// Skeleton of a minimal Win32 GUI app, written in Sphinx C--
//
// To compile, need "c--.exe" in same directory or in DOS path.
// The "#includepath" has path of the Windows header files.
// To compile, just type "c-- Minimal" -- that's it.

// INIT stuff
#pragma option w32     //create Windows GUI EXE.
#pragma option J0      //no startup code.
#pragma option dbg     //create debug information (separate .tds file).
#pragma option lst     //generate listing file.
#pragma option w       //enable warning.
#pragma option 3       //386 CPU.

#includepath "\sphinx\lib\win"
#include "windef.h--"
#include "winbase.h--"       //kernel32.dll
#include "wingdi.h--"       //gdi32.dll
#include "winuser.h--"       //user32.dll

#pragma option ia      //no need "$" or "asm" for inline asm.

// Variables used by main()...
dword g_hinst=0;
dword g_hwnd=0;
struct WNDCLASS s1;
struct MSG s2;

dword g_hstandardbrush=0;   // handle of background

char szTitleName="MINIMAL";
char szClassName="MINIMAL";

main()
{
  GetModuleHandle(NULL);        //startup code.
  mov g_hinst,eax               //  /

    // initialize the WndClass structure...
    s1.style=CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
    s1.lpfnWndProc=#WNDproc;
    s1.cbClsExtra=s1.cbWndExtra=0;
    s1.hInstance=g_hinst;
    s1.hCursor=LoadCursorA(0,IDC_ARROW);
    
    // Background stuff..
    GetSysColorBrush(COLOR_BTNFACE); //returns brush for window background.
    mov g_hstandardbrush,eax
    mov s1.hbrBackground,eax      //COLOR_WINDOW + 1

    mov s1.lpszMenuName,#szClassName
    mov s1.lpszClassName,#szClassName

    RegisterClass(#s1);
    test eax,eax
    jnz NOT_END //end_loop		//exit if eax=0.
    jmp end_loop
  
  NOT_END:

  CreateWindowEx(0,#szClassName,#szTitleName,WS_OVERLAPPEDWINDOW,5,5,300,200,0,0,g_hinst,0);
 
    test eax,eax
    jz end_loop		//exit if eax=0.
    mov g_hwnd,eax

    ShowWindow(g_hwnd,SW_SHOWNORMAL);
    UpdateWindow(g_hwnd);

  msg_loop:
    GetMessage(#s2,0,0,0);
    or eax,eax //cmp eax,0
    je end_loop
    TranslateMessage(#s2);
    DispatchMessage(#s2);
    jmp msg_loop

  end_loop:
    ExitProcess(s2.wParam);

}

// ..........................................................
// main callback procedure
// ..........................................................

dword WNDproc(dword  hwnd,wmsg,wparam,lparam)
{
  dword hdc;
  dword hbrushsaved;

    switch(wmsg)
    {
      case WM_DESTROY:    //DestroyWindow() generates this.
        PostQuitMessage(0);
        //...main() will get this and call ExitProcess() (see above).
        break;
//       case WM_COMMAND:
//       case WM_PAINT:
      default:
        DefWindowProc(hwnd,wmsg,wparam,lparam);
        jmp short getout
        //...note could have "return;" here but want common exit point.
    }
    xor eax,eax  //return 0 if have processed msg here.
  getout:
}

// ..........................................................
// end code
// ..........................................................

This is just an example I found on my hd.
It compiles to 1536 bytes.
Also this is only one way of doing it.

Here you get the files you need (a little bit slow...):
http://c--sphinx.narod.ru/indexe.htm
There is a new forum dedicated to Sphinx C--:
http://www.xsorbit2.com/users/csphinx/index.cgi

One guy made some wxWidget libs that can be used.
A minimal example would than look like this.

Code: Select all

#pragma option w32
#includepath "..\wxCmm"
#include "wxCmm.h--"

wxFrame frame;

void wxMain()
{
	frame.wxFrame(NULL, -1, "A minimal wxCmm example");
	frame.Show();
}
This wx code compiles to 8kb because of the bigger overhead you need with the wx stuff.

BTW: PureBasic's minimal Window boils down nowadays to 10kb.

Have fun :D :wink:

Posted: Tue Oct 19, 2004 8:41 pm
by thefool
thanks :)

i think we can agree that the site is slow hehe 8O

not that i wont stick with pb, but i think its fun to test other compilers as well.

Posted: Tue Oct 19, 2004 11:53 pm
by Moonshine
fsw wrote:BTW: PureBasic's minimal Window boils down nowadays to 10kb.
I managed to get an OpenGL window (plus numerous unused functions, custom callback & message loop etc) in 6.5k.

Im quite proud of my window functions, they work nicely :D

Posted: Wed Oct 20, 2004 4:54 pm
by fsw
nice :wink: