flat assembler
Message board for the users of flat assembler.

Index > Main > ccall#call; cinvoke#invoke? help me

Author
Thread Post new topic Reply to topic
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung 21 Dec 2010, 02:39
hi!

everybody can tell me what are different between ccall and call, cinvoke and invoke

In some case i must use cinvoke, if i use "invoke" my application will crash
why?

thank for reply Very Happy


sorry for my english

_________________
sorry for my english
Post 21 Dec 2010, 02:39
View user's profile Send private message Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 21 Dec 2010, 03:01
invoke, cinvoke, stdcall and ccall are macros to support calling conventions.

call is an assembler instruction supported by the CPU.

Use invoke for all Windows API calls except wsprintf (STDCALL)

Use cinvoke for all C library calls and wsprintf (CDECL)

Use ccall to call internal functions you have defined as CDECL compliant.

Use stdcall to call internal functions you have defined as STDCALL compliant.
Post 21 Dec 2010, 03:01
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 21 Dec 2010, 08:04
The difference between invoke and stdcall is that invoke calls the address at the address you pass, and stdcall calls the address itself. invoke internally uses stdcall to call the address at an address(ie with []). The same is true for the two cdecl macros.

To give an illustration:
Code:
invoke function, arg1, arg2 ; is the same as...
stdcall [function], arg1, arg2
    


Like revolution said, if you want to call a label you use stdcall or its cdecl cousin. When calling a label, you use it without [].
Post 21 Dec 2010, 08:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.