I am trying to get a definitive answer regarding the way COM behaves on a x64 machine. Does Windows use the normal x64 calling convention when dispatching calls to COM interfaces on x64 machines (assuming the COM implementation is 64 bits)? Specifically, I dynamically generate my vtbl entries to point to a chunk of assembly that's dynami...
I'm leaning some win32 programming, and the WinMain prototype looks like:
int WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show )
I was confused as to what this WINAPI identifier was for and found:
#define WINAPI __stdcall
What does this do? I'm confused by this having something at all ...
Hi StackOverflow,
I have a business case whereby I need to be able to specify my own calling convention when using P/Invoke. Specifically, I have a legacy dll which uses a non-standard ABI, and I need to able to specify the calling convention for each function.
For example, one function in this dll accepts its first two arguments via ...
Hi,
in my application I have 2 layers. The first layer is a C legacy exposing cdecl functions that use the "..." syntax for a varying parameter list. The only way I found to call these functions from my .Net layer (the second one) is using the DllImport technics. For example the C function below:
int myFunc(char* name, ...);
looks lik...
IS there a good use for inout (ref in C#, byref (like out parameters) in vb.net) parameters in .NET?
I feel that the confusion caused by a parameter used both as input and as a return value is worse that the increase in the number of parameters for out parameters, or returning an array or returning an custom class.
...
I can understand this requirement for the old PPC RISC systems and even for x86-64, but for the old tried-and-true x86? In this case, the stack needs to be aligned on 4 byte boundaries only. Yes, some of the MMX/SSE instructions require 16byte alignments, but if that is a requirement of the callee, then it should ensure the alignments ar...
I have a method in an object that is called from a number of places within the object. Is there a quick and easy way to get the name of the method that called this popular method.
Pseudo Code EXAMPLE:
public Main()
{
PopularMethod();
}
public ButtonClick(object sender, EventArgs e)
{
PopularMethod();
}
public Button2Click(o...
I'm writing some plugin code in a dll that is called by a host over which I have no control.
The host assumes that the plugins are exported as __stdcall functions. The host is told the name of the function and the details of the arguments that it expects and dynamically crufts up a call to it via LoadLibrary, GetProcAddress and manually...
There are different calling conventions available in C/C++ stdcall, extern, pascal etc. How many such calling conventions are available and what do each mean? Are there any links that describe these?
...
I am writing a Tiger compiler in F# and I have decided to emit x86 assembly. I know the basics of how a machine is constructed and also a bit of assembly, but not enough to write a good compiler back-end.
What resources can you recommend for learning what I need to know?
Where can I look up information such as calling conventions, etc....
Why should default parameters be added last in C++ functions?
...
We just had an interesting experience in trying to link a set of code compiled using Visual Studio Express 2008 with a .lib compiled with Visual Studio 2003. All in C++. To be precise, it was the SystemC 2.2.0 kernel that was compiled in VS2003 into a .lib, and a SystemC model which was compiled in VS2008.
When linking, we kept gettin...
I come across _stdcall a lot these days. And in my opinion msdn doesn't explain very clearly what it really means, when and why should it be used, if at all.
I would appreciate if someone would provide an explanation, preferably, with an example, or 2.
Thanks
...
Hey there,
I've just been experimenting with the boost::function_types library recently, and I've come across a bit of a snag. I want to find out the calling convention of a given function, however I'm not quite sure how to do this. Here's what I have so far:
This produces an error about how it cannot find the *_cc tag values inside e...
I am working on a project that links to a 3rd party static library (herin refered to as EXTERNALLIB). In Visual Studio 2005 I was able to link to EXTERNALLIB and create a usable executable. Now we are using Visual Studio 2008 and I am receiving the following error:
fatal error C1047: The object or library file EXTERNALLIB was created ...
From:
http://en.wikipedia.org/wiki/X86%5Fcalling%5Fconventions
push c
push b
push a
call function_name
add esp, 12 ;Stack clearing
mov x, eax
Why do we need to explicitly add 12 to ESP to clear the stack since the called function should have poped the parameters off the stack therefore restoring the stack pointer...?
Another questio...
When, if ever, is it faster to pass arguments as arguments to a static method rather than have the method be non-static and access the same values via instance members. Assume the method accesses these members in a read-only fashion.
All other things being equal, calling a static method is slightly faster than calling an instance metho...
When making a function call in Linux (or OS X for that matter), can the callee modify the values of the arguments on the stack? I was under the assumption that since the caller is the one that cleans them up, that they should contain the same values after the function call. However I found that GCC with -O2 was modifying parameters tha...
some one please tell me
how to change the default calling convention in c?
...
Hi stackoverflow
I've to do an interface (say, a wrapper) that allow a call from X86_64 assembly code using his calling convention to C function, with other calling convention. The best thing would be to be pretty "compiler independant" (juste modifying the wrapper), so i'm looking for something that puts registers/stack stuff on compi...