Re: Hardcoded insert string for the event messages



On Feb 4, 11:25 pm, Frank Kotler
<fbkot...@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Andy wrote:
On Feb 3, 8:04 pm, "Rick C. Hodgin"
...
Start out with small programs:

#include <stdio>
int main()
{
    printf("Hello world.\n");
    return(0);

}

And go up from there.  You'll learn about the stack, how parameter variables are passed between functions, return values are obtained, etc.

- Rick C. Hodgin

Have a C compiler.

Working with it when I have time.

Andy

I believe the code that I posted is Visual Studio C++ source code.

I installed Visual Studio.

When I figure out how to add the headers, resource files, etc.,
I'll make the executable, etc. :-)

This isn't what you'll see, but FWIW, here's what gcc does with it:

        .file   "hwc.c"
        .intel_syntax
        .section        .rodata.str1.1,"aMS",@progbits,1
.LC0:
        .string "Hello, World!"
        .text
        .p2align 4,,15
.globl main
        .type   main, @function
main:
        lea     %ecx, [%esp+4]
        and     %esp, -16
        push    DWORD PTR [%ecx-4]
        push    %ebp
        mov     %ebp, %esp
        push    %ecx
        sub     %esp, 4
        mov     DWORD PTR [%esp], OFFSET FLAT:.LC0
        call    puts
        add     %esp, 4
        xor     %eax, %eax
        pop     %ecx
        pop     %ebp
        lea     %esp, [%ecx-4]
        ret
        .size   main, .-main
        .ident  "GCC: (GNU) 4.2.1"
        .section        .note.GNU-stack,"",@progbits

Note that gcc has replaced the call to printf with a call to puts.
Uppity little bugger, innit? Well, I'd probably use puts instead of
printf for just a string anyway, so I guess it's okay...

Note the way the parameter is passed. Instead of a "push", as you'd
probably code it in asm, it's done as a mov! Faster! (at least if you're
doing a bunch of them) A slightly different prolog and epilog than
you're used to seeing, too, probably. I don't know if you're going to
learn anything useful from this or not...

It'll be interesting to see what VS does with it.

Best,
Frank

I posted a message at MSDN for this.

This project may take a tad while longer to finish. :-)

LINK : fatal error LNK1561: entry point must be defined
.