C++: Syntax for the other calling conventions

Talk about things C/C++, some related to AutoHotkey
User avatar
DojoMike
Posts: 6
Joined: 16 Aug 2017, 18:15
Contact:

C++: Syntax for the other calling conventions

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. :)
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

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

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
Recommends AHK Studio

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 6 guests