stdcall

stdcall calling convention and using pinvoke in C#

本秂侑毒 提交于 2019-12-24 12:44:20
问题 I created a DLL file which includes two empty functions below. extern "C" __declspec(dllexport) void __stdcall myFunc1() { // just empty function } extern "C" __declspec(dllexport) void __cdecl myFunc2() { // just empty function } In C#, I could call the functions using DLLImport attribute like below. [DllImport("myDLL", CallingConvention=CallingConvention.StdCall)] private extern static void myFunc1(); [DllImport("myDLL", CallingConvention=CallingConvention.Cdecl)] private extern static void

__stdcall typedef g++ problem

余生颓废 提交于 2019-12-24 05:33:12
问题 This code compiles (as I would expect): typedef void __stdcall (*Func)(); struct A { static void __stdcall f() { } }; int main() { Func p = A::f; } But this one: struct A { typedef void __stdcall (*Func)(); static void __stdcall f() { } }; int main() { A::Func p = A::f; } fails with not-very-helpful error message: error: invalid conversion from `void (*)()' to `void (*)()' I'm using g++ 3.4.2 under Vista (I know, it's ancient, but I don't have access to any other environment right now).

Calling a function that can be either cdecl or stdcall

我的梦境 提交于 2019-12-23 10:51:22
问题 I need to write code that calls an external function that can be either stdcall call or cdecl in a 32bit windows application. My code, the caller, can't know in advance which of these its going to be. Right now, if I try to call a cdecl function from a call site that was defined as stdcall, I get a checkEsp exception dialog, and I'm guessing that's there for a good reason. Is there any way to do it? 回答1: It can be done following way: mov esi, esp push arg3 push arg2 push arg1 call

How to make stdcall from Go

二次信任 提交于 2019-12-22 10:24:10
问题 I have a pointer to a COM interface and would like to take the function pointers from its virtual table and make method calls. To do this I need to make stdcall method calls. In Go how do I make a call with convention stdcall or make a call with convention stdcall in cgo? 回答1: See "godoc syscall Proc" for instructions on how to call stdcall functions on windows. Be warned that *Proc.Call does allocate / deallocate memory, so, if you care about efficiency, you should use correspondent syscall

How to make stdcall from Go

。_饼干妹妹 提交于 2019-12-22 10:21:35
问题 I have a pointer to a COM interface and would like to take the function pointers from its virtual table and make method calls. To do this I need to make stdcall method calls. In Go how do I make a call with convention stdcall or make a call with convention stdcall in cgo? 回答1: See "godoc syscall Proc" for instructions on how to call stdcall functions on windows. Be warned that *Proc.Call does allocate / deallocate memory, so, if you care about efficiency, you should use correspondent syscall

Is there any equivalent for stdcall in GCC?

旧城冷巷雨未停 提交于 2019-12-18 21:21:52
问题 I'm working on my own kernel using GCC, and when calling C functions from asm code, I have to do add esp,xx myself. After some searching I found that stdcall is a Microsoft invention and can't use it in GCC. Is there any handy way to do this work? 回答1: Is there any equivalence of stdcall in linux? my kernel in a linux environment Wait, is this your own kernel, or the Linux kernel? Because if it's your own kernel, it's not Linux any more. If you're working on Linux, you'll want to stick with

stdcall name mangling using extern c and dllexport vs module definitions (msvc++)

强颜欢笑 提交于 2019-12-17 19:33:42
问题 I was trying to export a simple test function for a dll to work with an application (fyi: mIRC) that specifies the calling convention as: int __stdcall test_func(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) Now, to call this from the application, I'd be using test_func but I have noticed due to name mangling it is not as simple as I'd thought. Through similar topics here I have come to the understanding that using extern "C" in combination with __declspec(dllexport)

Template partial specialization for __stdcall function pointer

故事扮演 提交于 2019-12-12 07:52:03
问题 typedef bool (*my_function_f)(int, double); typedef bool (__stdcall *my_function_f2)(int, double); // ^^^^^^^^^ template<class F> class TFunction; template<class R, class T0, class T1> class TFunction<R(*)(T0,T1)> { typedef R (*func_type)(T0,T1); }; int main() { TFunction<my_function_f> t1; // works on x64 and win32 TFunction<my_function_f2> t2; // works on x64 and doesn't work on win32 return 0; } The code above gives me the following error in Visual C++ 2010: 1>e:\project\orwell\head

How do I compile boost using __cdecl calling convention?

最后都变了- 提交于 2019-12-12 01:54:59
问题 I have a project compiled using __cdecl calling convention (msvc2010) and I compiled boost using the same compiler using the default settings. The project linked with boost but I at runtime I got an assert message like this: File: ...\boost\boost\program_options\detail\parsers.hpp Line: 79 Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer

The procedure entry point axiom_attribute_create could not be located in the dynamic link library

我只是一个虾纸丫 提交于 2019-12-12 01:46:31
问题 I have a project in c and I want to compile it in CodeBlocks with MinGW. I tried to link its needed libraries but I got undefined reference error so I searched and found out that the libraries that I was using was compiled with MVC++ and cannot be used with MinGW. (I am not an expert in c, so I'm a little bit confused.) I found This link and did what they said in order to solve my problem. I have created axis2c .a files from the original axis2c .dll files. I created .def files with reimp then