C and C++

Post here questions, problems and suggestions in English language
  • It is already possible to write applications in C.
    The articles on diamondz.land.ru might be a good place to get some info about it. (some articles are in english altough the site is in russian)
    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
  • Hmm... Do you think you will support C++ next release? I'd also be cool if you could support java in the future... Btw when I use your os the mouse flickers a lot. I don't think its my pc because when I run windows it doesn't do that. Also it says I only support video modes 9 and 0, but I have pretty good graphics and such, maybe my hardware isn't supported by the os?
  • Your graphics card doesnt seem to be fully VESA compliant.
    What brand of card do you have?
    Kolibrios uses most graphics cards in VESA mode..

    C++ should work, but as i'm not a c++ coder, i can't help you on that..
    Java really is out of the question for now.
    It would be a lot of work, and it's not wortht right now.

    The mouse flicker could have something to do with VGA modes (0 and 9)
    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
  • Not sure, but it runs 1024x768(24bit). None of my C++ programs work on it :/. Are there some specail header files I have to include and write the extra stuff like it showed on the daimond site?
  • As already been said by hidnplayr, you need to read http://diamondz.land.ru/hll/hll_eng.htm to understand how to write programs for Kolibri using HLL such as C/C++. Kolibri is not Windows/Linux, it has its own executable file format thus some magic is needed to compile them. If you have any specific questions after reading the article go ahead and ask.
    in code we trust
  • I'm currently learning Masm so I loked at the site and I followed how to assemble it my batch file looks like:

    Code: Select all

    cd C:\jbpub\Detmer\Software
    ml /nologo /c /coff %1.asm
    link /fixed /subsystem:native /base:-0x10000 /align:0x10000
    		/merge:.data=.text /merge:.rdata=.text /nologo %1.obj
    I get the following errors with link.

    Code: Select all

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:\Documents and Settings\Owner>C:\jbpub\Detmer\KolibriOS\Make.bat test
    
    C:\Documents and Settings\Owner>cd C:\jbpub\Detmer\Software
    
    C:\jbpub\Detmer\Software>ml /nologo /c /coff test.asm
     Assembling: test.asm
    
    C:\jbpub\Detmer\Software>link /fixed /subsystem:native /base:-0x10000 /align:0x1
    0000
    Microsoft (R) 32-Bit Incremental Linker Version 5.10.7303
    Copyright (C) Microsoft Corp 1992-1997. All rights reserved.
    
    LINK : warning LNK4108: /ALIGN specified without /DRIVER or /VXD; image may not
    run
    LINK : warning LNK4001: no object files specified; libraries used
    LINK : warning LNK4068: /MACHINE not specified; defaulting to IX86
    LINK : fatal error LNK1159: no output file specified
    
    C:\jbpub\Detmer\Software>/merge:.data=.text /merge:.rdata=.text /nologo test.obj
    
    The filename, directory name, or volume label syntax is incorrect.
    
    C:\jbpub\Detmer\Software>
    What am I doing wrong?
  • The problem is that last two lines in the batch file should be written in a single line.
    in code we trust
  • Now I get...

    Code: Select all

    C:\jbpub\Detmer\KolibriOS>C:\jbpub\Detmer\Software\link /fixed /subsystem:native
     /base:-0x10000 /align:0x10000 /merge:.data=.text /merge:.rdata=.text /nologo te
    st.obj
    LINK : warning LNK4108: /ALIGN specified without /DRIVER or /VXD; image may not
    run
    LINK : error LNK2001: unresolved external symbol __start
    test.exe : fatal error LNK1120: 1 unresolved externals
    
  • Please make sure you have "_start" as a label for your entry point:

    Code: Select all

            .486
            .model  flat
    
    .data
    ; header
            db      'MENUET01'
            dd      1
            dd      offset _start
    ...
    .code
    _start:
    ...
            end     _start
    
    in code we trust
  • I get that on every code I try. I get LINK : error LNK2001: unresolved external symbol _NtProcessStartup on this one.

    Code: Select all

    ;Foofatron 2008
    
    .486
    .MODEL FLAT
    
    ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
    
    GetStdHandle PROTO NEAR32 stdcall,
        nStdHandle:DWORD
    
    WriteFile PROTO NEAR32 stdcall,
        hFile:DWORD, lpBuffer:NEAR32, nNumberOfCharsToWrite:DWORD,
        lpNumberOfBytesWritten:NEAR32, lpOverlapped:NEAR32
    
    STD_OUTPUT EQU -11
    
    cr      EQU     0dh     ; carriage return character
    Lf      EQU     0ah     ; line feed
    
    .STACK
    .DATA
    
    Hello BYTE    "Hello World!", cr, lf
    msgLng  DWORD   12   ; number of characters in above message
    written DWORD   ?
    hStdOut DWORD   ?
    
    .CODE  
    _start: 
            INVOKE GetStdHandle,    ; get handle for console output
              STD_OUTPUT
            mov    hStdOut, eax
    
            INVOKE WriteFile,
              hStdOut,              ; file handle for screen
              NEAR32 PTR Hello,   ; address of string
              msgLng,               ; length of string
              NEAR32 PTR written,   ; bytes written
              0                     ; overlapped mode
    
            INVOKE  ExitProcess, 0  ; exit with return code 0
    
    PUBLIC _start
    END
    
    
    the batch file is:

    Code: Select all

    D:\jbpub\Detmer\
    D:\jbpub\Detmer\Software\ml /nologo /c /coff Hello.asm
    D:\jbpub\Detmer\Software\link /fixed /subsystem:native /base:-0x10000 /align:0x10000 /merge:.data=.text /merge:.rdata=.text /nologo Hello.obj  kernel32.lib
    
    I tried to assemble the example for MASM on http://diamondz.land.ru/hll/hll_eng.htm but got the _start error... Same batch file as a bove just a diffrent name.
  • Okay, you got me. Is this really that difficult to use MASM to develop for Kolibri? Let's see...
    Suppose I'm in big love with MASM and want to use it to write programs for Kolibri. Even the fact that I'm running Linux on my home PC can't stop me and I set up Windows on virtual machine. What do I do next? I read the article, I go to http://movsd.com, download version 9.0 (latest) of the assembler and intall it. I also download and unpack FASM version 1.67.27 (latest) for Windows (http://flatassembler.org). Then I create a file with sample code from the article (in the root of C:\ drive) and use first two commands from the same article to compile and link it. Then I create "doasm.asm" file in the same directory (I get it from the article too) and execute third command.
    Please tell me what am I doing wrong because I can't understand WHY the heck don't I get any errors?

    Code: Select all

    C:\>c:\masm32\bin\ml /nologo /c /coff hello.asm
     Assembling: hello.asm
    
    C:\>c:\masm32\bin\link /fixed /subsystem:native /base:-0x10000 /align:0x10000 /merge:.data=.text /merge:.rdata=.text /nologo hello.obj
    LINK : warning LNK4108: /ALIGN specified without /DRIVER or /VXD; image may not run
    LINK : warning LNK4078: multiple ".text" sections found with different attributes (C0000040)
    LINK : warning LNK4078: multiple ".text" sections found with different attributes (40000040)
    
    C:\>c:\fasm\fasm.exe doexe.asm hello
    flat assembler  version 1.67.27  (669592 kilobytes memory)
    1 passes, 192 bytes.
    
    C:\>
    PS: your latest post has nothing to do with Kolibri (am I right?) since you can't use WinAPI to create Kolibri programs. Kolibri has it's own API you should learn: http://kolibrios.org/?p=Documentation&s ... ns&lang=en.
    in code we trust
  • I wasn't using any windows api in that it was a command line program that said hello world! I was having trouble so I decided to write a simple program to see if it'd work... It work with the that verson of MASM, but how can I create like command line programs? Kernel32 won't work with Kos so is there a lib file or something for it?
  • Who is online

    Users browsing this forum: No registered users and 15 guests