- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试移植 this code到 Perl6。虽然我可以调用 GetStdHandle
、GetConsoleMode
和 SetConsoleMode
,但当我尝试调用 ReadConsoleInput
时我的脚本会中断:
Cannot locate symbol 'ReadConsoleInput' in native library 'Kernel32.dll'
in method setup at C:\rakudo\share\perl6\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 287
in method CALL-ME at C:\rakudo\share\perl6\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 576
in block <unit> at test.p6 line 149
现在,该函数是 definitly there .虽然它有一个复杂的签名,但我不确定我的脚本是否正确。这可能是原因吗? NativeCall 看签名吗?
这就是我在代码中定义 sub 的方式(注释取自 MS 文档)
#BOOL WINAPI ReadConsoleInput( _In_ HANDLE hConsoleInput, _Out_ PINPUT_RECORD lpBuffer, _In_ DWORD nLength, _Out_ LPDWORD lpNumberOfEventsRead );
sub ReadConsoleInput(Pointer[void], INPUT_RECORD is rw, uint32, uint32 is rw) is native('Kernel32') returns Bool { * };
如果需要,我可以发布我的其余代码,但它是很多样板文件,因为我必须定义所有结构和内容,并且通常来自头文件。
最佳答案
真正的函数名称是ReadConsoleInputA
或ReadConsoleInputW
,这取决于您想要ANSI 还是Unicode (UTF-16) 输入。 C header 具有根据预处理器符号自动将 ReadConsoleInput
转换为正确函数的宏。但是当你像这样在运行时加载函数时,你必须准确指定你想要的函数。
关于windows - NativeCall 在 Kernel32.dll 中找不到函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57582796/
我正在尝试为 Cgraph 创建 Perl6 绑定(bind),其中一个结构为其某些属性设置了位字段,其值低于 8。我应该如何在我的模块中表示它? 我尝试使用 is nativesize(x) 定义自
我目前正在尝试使用 Java 中的 NTX 索引访问 DBF。我有一个多年前的 Artemis 引擎(现在的 ApolloDB)的副本,它可以在 VB6 中执行此操作。它使用 3 个 DLL,主要是
我有两个库,我想调用第一个库中的例程,然后它们调用第二个库中的例程,但由于这些符号未定义而崩溃。即使我不想调用它们,是否可以从库 XX 中说“加载这些符号”? teSTLib1.c: #include
我在 Buf 中有一大块内存我想传递给 C 库,但该库将使用超出单个调用生命周期的内存。 我知道这可能会有问题,因为垃圾收集器可以移动内存。 用于传递 Str , Nativecall docs 说“
我正在为 Editline 编写绑定(bind);它的功能之一, history ,为库的这一部分完成大部分工作,但有几个可能的签名: :(Pointer[Internal], Pointer[Eve
软呢帽 33 乐 我正在尝试使用 Raku 的 NativeCall 与 libX11.so 对话以打印出我的屏幕和显示: use NativeCall; class Display is repr(
https://docs.perl6.org/language/nativecall "As you may have predicted by now, a NULL pointer is re
我有一个第三方 C 库,它定义了类似于以下内容的结构: struct myStruct { int a; int b; char str1[32]; char str2[32]; };
试图与一个 C 库接口(interface),该库采用一个结构,该结构带有一堆指向它在各个点调用的函数的指针。 像这样的东西: struct callbacks { int (*foo)(in
Perl 6 docs列出一堆类型。其中一些,例如 Str ,有更复杂的装箱/拆箱行为。 是否可以定义我自己的类型,指定我自己的装箱/拆箱例程?对于一个特定的项目,我有一堆我正在重用的类型,并且基本上
我正在尝试使用 NativeCall 与一些 C 函数交互。 对于一种情况,我需要传入由函数,因此它需要一个指向指针“void **”的指针。 我尝试过这样的: class Foo { has
我正在尝试使用 NativeCall 与一些 C 函数交互。 我有一个简单的 C 结构体和一个需要它们数组的函数。 struct foo { int x; char *s; }; st
我正在尝试移植 this code到 Perl6。虽然我可以调用 GetStdHandle、GetConsoleMode 和 SetConsoleMode,但当我尝试调用 ReadConsoleInp
有没有一种方便的方法来处理在不同平台上可能具有不同值的 C typedef? 例如 #if defined(_WIN32) #define foo_t int32_t #elif define
我希望能够在具有 REPR CStruct/CPointer 的类中使用双指针: typedef struct CipherContext { void *cipher;
在 Windows 和 Linux 上使用 NativeCall 为 C 库发布 Perl 6 绑定(bind)的最佳策略是什么? 开发者是否需要同时编译.dll和.so文件并用perl6代码上传到g
我正在使用 NativeCall 来熟悉 Perl6 的那一面。当然,我想先加载 libstatgrab(还有什么?)。 所以我从最简单的部分开始——主机信息。由于还没有集群支持,这只是一个结果——不
我正在使用 NativeCall 接口(interface)。 该库将多次调用我的回调函数。 这很好用。我可以用正确的方式声明我的回调 签名,将其作为 &callback 传递,库只调用 sub 美好
这些代码片段可能看起来很奇怪,这是因为我从我的原始代码开始并切断了部分,直到我到达重现错误的最小指令集。所以忍受表面上的无用。 perl6模块有两个,一个use s另一个,和一个程序。 这是第一个模块
有没有办法在 CStruct 中声明一个对象数组? struct my_struct { int foo; int bar; char somestring[80]; }; c
我是一名优秀的程序员,十分优秀!