C++: Syntax for the other calling conventions

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: C++: Syntax for the other calling conventions

Re: C++: Syntax for the other calling conventions

Post by nnnik » 22 Aug 2017, 01:56

I think it was this tutorial that will make you understand a bit more about calling conventions:
https://autohotkey.com/boards/viewtopic.php?f=7&t=5567

C++: Syntax for the other calling conventions

Post by DojoMike » 21 Aug 2017, 20:41

Hey there,

I'm writing a script that converts a C/C++ header file to AHK functions that wrap the DllCalls. For example, it would take this:

Code: Select all

extern "C" __declspec(dllexport) int add(int x, int y);
and turn it into this:

Code: Select all

add(x, y)
{
    return DllCall("myDLL.dll/add", "int", x, "int", y, "Cdecl int")
}
Now every time I've written a DLL function, it has used the "C" calling convention, mostly because I'm not sure what the others are or how to use them. I did a bit of research on MSDN and found 3-4 others that are Windows-specific, but it was just a list (no example use). So any info on the subject would be awesome.

PS: I think a script like this would help newbies and pros alike, and I'm cool with doing it on my own, but it's a big project (especially when you get into pre-processor directives, typedefs etc. that can affect the compiled DLL). So if you like this idea, I'd be glad to team up on this. :)

Top