News:

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

Want to learn

Started by Robert Husted, December 29, 2004, 09:27:12 PM

Previous topic - Next topic

Robert Husted

Hi everyone my name is Robert. I'm a newbe to masm and have a few questions 1 what are apis(in laymens terms)? and what are dlls and how do the apply to the program. from what I understand the apis are calls from windows to preform cirtin procs they reside in dlls right if not please help. I am reading Iczelion's tutorials now I will try some of his exaples tonight. I will be on the net around 1200am east if anyone can help or e-mail me at box4rob@yahoo.com THANKS




thanks guys this seems to help a bit if i could apply it in some simple code it may just become extra clear thanks for the help!!!!!!!!!!!!!!!!

rea

An API is an Application Programming Interface, the most important part in this is the word Interface

A Interface is a contract between two diferent entities for interact with each other, for example, there exist the Graphic interface that have a representation in the screen, the keyboard is also a interface and the mouse too, for example there are Interfaces for comunnication like protocols a sinonime can be a protocol==Interface.


A Interface can not be considered a language because it already uses a language for his own definition, but in that way, can be considered a generated subset of a language (extrange term ;)). The point here is that have a Interface modelate/limitate the way that the two diferent parts interact in a logic way.





A Interface define the necesary things for two diferent matters can communicate in a defined field.

In programming terms this field is defined mainly by: functions, structures and some constants.

The Interface is self contained (normally), consistent (normally), have/define his own semantics and define a field/set of communication/interaction dont know what other "attibutes" I can attach to it.

- Self Contained: Im not talking about dependency, Im talking about that is well defined in his own terms... (I need take more care in describe this.. I guess)
- Consistent: Because the Interface define a field for Interaction, this field with his semantics is consistent, mean that it will not make a thing that should not do.
- Have/Define his own semantics: for the consistency of the same field, you should follow some steps for be tunned in the field, for example, when there is a secuence of steps and you not do one of them, you are breaking the semantics there, like if you try write to a pointer without allocate some space for the pointer (some like that).



I think that explain much about a Interface, remember is the central word of the three words.

DLLs are files that contain a bunch of functions, that can be relocated at runtime, and not the relocation like in the load of your exe or in the compilation of your exe when is statically linked. Some one will whant to explain rellocation best than I (I gues I will extend much for exaplain it.. :S).

In fact, any programm or any funcitons can be contained inside a DLL, even if Im not wrong, you can use a .exe like a DLL.


Hope that can help you out.

donkey

Hi Robert,

The API is as rea said the "Application Programming Interface". Certain functions must be standardized in an OS in order for it to function properly. For example you cannot have more than 1 way at a time to structure your hard drive if you want everything to be able to read it. In order to guarantee this Windows performs these operations and your program only makes requests for it to perform a given function. Windows has a set of primitive functions that it performs such as drawing windows, managing the desktop and file system, as well as communications. In order to do just about anything that Windows has control over you must pass the request through the API.

Yes, the entire API resides inside various DLLs or Dynamic Link Libraries. These are executable files that are mapped into your programs memory space and essentially become part of your program. In the same way that the C standard library includes code in your executable directly, a DLL includes code indirectly. When a DLL is loaded into your program space, it's functions (or exports) are available as if they were actually in your program. The mapping scheme and alot of the technical details should not concern you just yet, for now you have just to remember that every Windows function resides in a DLL and it must be loaded before it can be used. When you include and includelib in MASM it is actually adding the jumps and loader code necessary to load those DLLs when your program starts so you don't have to do it programatically (ie LoadLibrary/GetProcAddress).
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Titan

Quote from: Robert Husted on December 29, 2004, 09:27:12 PM
Hi everyone my name is Robert. I'm a newbe to masm and have a few questions 1 what are apis(in laymens terms)? and what are dlls and how do the apply to the program. from what I understand the apis are calls from windows to preform cirtin procs they reside in dlls right if not please help. I am reading Iczelion's tutorials now I will try some of his exaples tonight. I will be on the net around 1200am east if anyone can help or e-mail me at box4rob@yahoo.com THANKS
Hi Robert,
I just started learning assembly a few weeks ago, I read the MASM documentation "ASM Intro Help" in the Help menu of MASM32, and it helped me a lot understanding the registers, stacks, ect...  I'd suggest reading that first to get yourself some broad knowledge of assembly before starting Iczelion's excellent Win32 tutorials.

- Mike

tenkey

The APIs are simply sets of subroutines that have been supplied by some software house. There is a core set of subroutines supplied by Microsoft called the Win32 API. The Win32 API has grown over the various versions of 32-bit Windows. Microsoft also supplies subroutines in sets that were originally conceived as being separate from the Win32 API. Most programmers don't make any distinctions between these various sets, assuming all of them to be part of the Win32 API.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

Statix Star

HLA Art Of Assembly Language, for complete new ones. Unless you want to choose another assembler.