News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

To include or not to? (absolute beginner question)

Started by ThexDarksider, September 24, 2009, 11:45:49 PM

Previous topic - Next topic

ThexDarksider

I'm back... :bg Into the strange and beautiful world of assembly programming.

I kinda forgot everything that I knew so I'm starting all over... Hello world! :bg

I have a (really stupid) question though, is there any difference between using the 'include' directive and then using 'call' thing to call stuff from APIs, and doing stuff manually with 'extrn FunctionName:PROC' thing? I've found that both of them have a problem (a problem for me, because I'm new to this lol). When I use 'include \masm32\include\kernel32.inc', I must put 'stdcall' into .model or else it spams with errors and fails. And when I try with 'extrn', it says "unresolved external blah blah"... Note: I use 'includelib \masm32\lib\kernel32.lib' in both cases.

What I'm trying to do is to call ExitProcess... Yeah you can laugh too. lol

Well at least some time has passed and I believe I'm a bit more mature, I still remember fighting with the guy named Slugsnack and pissing the admin off, I'm sorry for that, guys...

And again, a big hello world to everyone! :toothy It's always fun to learn a new (programming) language! :)

hutch--

 :bg

The choices are simple, either use the existing include files or write them yourself. Trust me in this much, unless you have a very long time to write include files with the help of C compilers to get certain types of outputs, specialised tools to test for duplicates, endlessly crawling through Microsoft documentation and the like, you will use the existing ones.

As far as using STDCALL in the leading directives, it saves the assembler reading thousands of STDCALL directives while loading the include files and as STDCALL is the standard for win32, it is simply a matter of efficiency to do it that way. You write exceptions by specifying the prototype for a function with one of the others, mainly C.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ThexDarksider

Thanks for replying. :U I'll stick with the existing ones.

Also a similar question, what's the difference between:

push 0
call FunctionName

and:

invoke FunctionName,0

or is it the same?

BlackVortex

The final code is the same. But it's better to use invoke, because it also does some basic error checking.

ThexDarksider


dedndave