问题标签 [stdcall]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
276 浏览

c++ - 在 VS2010 中使用 Delphi DLL。“在 DSOLink.dll 中找不到函数 _DataReady@0 的入口点”

我正在尝试在我在 Visual Studio 2010 中用 C++ 编写的一个项目中使用数字示波器 Vellman PCSU1000。

为此,我需要使用设备制造商提供的两个 DLL:DSOLink.dll 和 PCSU1000D.dll。我没有任何其他相关文件。据我从手册中了解到,这些 DLL 是在 Deplhi 中编写和编译的。每个 DLL 中包含的函数以及如何在不同的编程语言中使用它们都有一个简短的描述。对于 C++ 语言制作者,选择了 Borland C++ Builder 并添加了以下代码(对于使用 DSOLink.dll,它与 PCSU1000D.dll 类似): DSOLink.h

根据 MSDN 中的说明:http: //support.microsoft.com/kb/131313 我创建了一个 .lib 文件。由于构建解决方案成功完成,但调试返回错误消息“在 DSOLink.dll 中找不到函数 _DataReady@0 的入口点”。

从文章中:http : //bcbjournal.org/articles/vol4/0012/Using_Visual_C_DLLs_with_CBuilder.htm?PHPSESSID=ab5f6c83b3da921591a490a5accb5bf7 我知道在 C++ Builder 中,关键字 *__stdcall* 表示没有装饰对流,而在 VS 中则完全相反。

我知道在这种情况下,我不得不在 VS 中使用 *__stdcall* (它必须是在 DLL 和应用程序中使用的标头中管理堆栈清理的相同方法)和无装饰方法...我已阅读 .DEF 文件可能会有所帮助,但我不知道应该如何使用它。我试图以不同的方式创建 DEF:

并立即将其中一个添加到我的项目中,但没有一个能解决问题。

有谁知道强制 VS 不使用并且不期望带有 *__stdcall* 的修饰名称的正确方法是什么?或者也许我的问题的原因是不同的,有人知道吗?

提前致谢。

0 投票
1 回答
162 浏览

c++ - QtConcurrent::run() 不接受 __stdcall/WINAPI 函数

我试图使用 执行具有__stdcall调用约定的 DLL 函数QtConcurrent::run(),但出现编译错误。

我已将问题简化为此示例代码:

如果我删除__stdcall代码编译并运行良好。否则我会得到这些编译错误:

为什么会发生这种情况,最好的解决方法是什么?

0 投票
3 回答
473 浏览

assembly - 调用可以是 cdecl 或 stdcall 的函数

我需要编写调用外部函数的代码,该函数可以是 32 位 Windows 应用程序中的 stdcall 调用或 cdecl 。
我的代码,调用者,不能提前知道它会是哪一个。现在,如果我尝试从定义为 stdcall 的调用站点调用 cdecl 函数,我会得到一个 checkEsp 异常对话框,我猜这是有充分理由的。
有什么办法吗?

0 投票
1 回答
233 浏览

c++ - QT - 3rd 方回调不回调?

我为我正在使用的第 3 方库创建了一个测试应用程序,它编译得很好,但似乎从来没有达到 __stdCall WriteDone。

从示例代码看起来像这个函数

调用此代码,但据我所知,它永远不会在这里出现。

这是整个测试应用程序

0 投票
1 回答
451 浏览

c++ - GNU 内联汇编:__stdcall 破坏了哪些寄存器?

如果我call通过 GNU 的 C++ 代码中的内联汇编程序使用该指令来调用我知道使用__stdcall约定的函数,我是否必须将任何寄存器列为被破坏的?

我在互联网上找不到很好的指导,但它看起来像%eax,%edx%ecx是调用者保存的,前两个保留用于返回值。

这是我的代码。我想知道我需要在第三个冒号后面放什么。

这个消息线程是我在互联网上能找到的最好的,但我找不到任何说“这是__stdcall假设它可以在不保存的情况下修改”...

0 投票
2 回答
1074 浏览

c++ - how to use assembly to get the result of a __stdcall function that returns float

I have an assembly routine that calls, in a generic way, a function known to use the stdcall convention and return a float. This function is being used by a marshalling framework to expose stdcall functions to a scripting language.

Background

Here's the function using GNU inline assembly that compiles on MinGW 4.3, Win32:

This is just a little glue to make it easier to write test cases:

Now I have some test cases that invoke this function:

Problem

Randomly, test 3 is giving me garbage output instead of returning -1.0.

I'm wondering if I'm

  • failing to preserve some state before the call instruction?
  • messing up some state with the fsts instruction?
  • fundamentally misunderstanding how to get a float value from a stdcall function that returns float????

All help greatly appreciated.

0 投票
1 回答
5495 浏览

c++ - 错误 C2143:语法错误:缺少“;” 在“__stdcall”之前

我在创建 COM DLL 时遇到了一些麻烦。我的 IClassFactory 实现如下所示:

我的问题是 Visual Studio 总是说“错误 C2143:语法错误:缺少';' 在第 6 行(以及更多行)的“__stdcall”之前。我已经用谷歌搜索了,我发现我必须包含 windows.h。但这并不能解决我的问题......任何人都知道我的代码有什么问题或者我必须包含什么来解决问题?通过编译头文件,我得到了同样的错误:

顺便说一句,代码基于 codeguru 的教程。

0 投票
2 回答
415 浏览

c++ - 对于 Windows 程序的调用约定,声明什么更好?

我读过一篇关于Calling convention(__stdcall、__fastcall、pascal、cdecl 等...)的文章

我想知道:为什么经常为 WinMain() 函数声明 __stdcall (WinAPI)?

正如我所读到的,使用__stdcall堆栈__fastcall进行操作,对寄存器进行操作,根本不使用堆栈。

所以,我试图. __fastcall编译器(Visual C++)给了我一个错误。

为什么我不能__fastcall用于 WinMain() 并且有可能使用它吗?

因为在不使用堆栈的情况下处理寄存器要快得多,不是吗?

PS我的建议是,有一些方法合同不允许我使用__fastcall,但这只是我的建议。

0 投票
1 回答
1942 浏览

c - Howto create C-Header for Delphi/Free Pascal/Lazarus DLL - data types

For my application I need to create a DLL from Delphi (to be more precise Delphi compatible code written within Lazarus IDE compiled by free pascal under linux) using stdcall.
When using that DLL (for example in Matlab or so) one needs of course the meta information for passing the arguments - often realised with a header file. I'm searching for a tool do to that running on the delphi source code. Something like h2pas-reverse.
My research yielded no results. As I think, there is no such tool, I'd like to find a table or other information, how the Delphi/Pascal data types are mapped to C types and how to work with records.

0 投票
3 回答
471 浏览

winapi - Windows函数名称后跟@数字符号?

我在 NASM 中为 Windows 进行汇编编程,我在代码中发现了这一点:

@4winapi库函数的声明和调用是什么意思?