Page 1 of 1

C++: Syntax for the other calling conventions

Posted: 21 Aug 2017, 20:41
by DojoMike
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. :)

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

Posted: 22 Aug 2017, 01:56
by nnnik
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