Advice on which C to hang one's hat.

For everything that's not in any way related to PureBasic. General chat etc...
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Hi Max.²

Thanks for the link. It also handles net (clr), it seems.
@}--`--,-- A rose by any other name ..
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

@tinman: thanks for the link :) ill download it tomorrow

@dare2: hehe yes there is a pretty big difference :D
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Max.²: Ive downloaded that already (despite having no C/C++ knowledge) but is it all based on the .net framework or what?
Mark my words, when you least expect it, your uppance will come...
Max.²
Enthusiast
Enthusiast
Posts: 175
Joined: Wed Jul 28, 2004 8:38 am

Post 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
Last edited by Max.² on Sun Oct 17, 2004 11:49 pm, edited 1 time in total.
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post 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/
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Max.²: Yes thats what I meant, cheers :)
Mark my words, when you least expect it, your uppance will come...
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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
@}--`--,-- A rose by any other name ..
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Ten more reasons to love PB :lol:
Mark my words, when you least expect it, your uppance will come...
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

You really should give Eiffel a try.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post 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.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

50+ megs footprint??
i made a 3 kb hello world with devc++

but ill try the c--. how are the syntax?
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post 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:
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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.
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post 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
Mark my words, when you least expect it, your uppance will come...
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

nice :wink:
Post Reply