在Windows中,有一个默认的C库msvcrt.dll。
是否可以编写仅使用 msvcrt.dll 中的函数的简单 C 程序?这将减轻安装最新 VC 运行时的需要。
我认为一种可能的方法是显式指定/NODEFAULTLIB,并使用dll导入过程来导入msvcrt.dll函数。
有人有线索吗?
我试图通过按Escape键退出循环,但是我的程序不起作用。有没有办法做到这一点?我的代码:
import win32api
import win32con
import time
from msvcrt import kbhit,getch
def clickerleft(x,y):
"""Clicks on given position x,y
Input:
x -- Horizontal position in pixels, starts from top-left position
y -- Vertical position in pixels, start from top-left position
"""
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
def fonctionclic():
while True :
clickerleft(1193,757)
time.sleep(0.1)
while True :
key = ord(getch())
if key == 97: #a
fonctionclic()
elif key == 27: #escap
break
Run Code Online (Sandbox Code Playgroud) 这个问题特别是关于非便携式 MSVC ABI 的东西。
我正在尝试typeid
用明显不可移植但又不神奇的 C++编写等效的C++。对于 Itanium ABI(在 Linux/Mac 上使用),它非常简单:
const std::type_info& dynamicast_typeid(void *mdo)
{
std::type_info **vptr = *reinterpret_cast<std::type_info ***>(mdo);
std::type_info *typeinfo_ptr = vptr[-1];
return *typeinfo_ptr;
}
Run Code Online (Sandbox Code Playgroud)
所以现在我正在查看 64 位 MSVC ABI,并且该死的,我被难住了。对于非常简单的类,那些以 vfptr 开头的偏移量为 0 的类,它几乎和 Itanium 一样简单:
const std::type_info& dynamicast_typeid(void *mdo)
{
int *rtti_complete_object_locator = ((int ***)mdo)[0][-1];
char *result = (char *) rtti_complete_object_locator;
result -= rtti_complete_object_locator[5];
result += rtti_complete_object_locator[3];
return *(std::type_info*)result;
}
Run Code Online (Sandbox Code Playgroud)
(此代码基于Wine 项目的__RTtypeid
.)
问题是某些 C++ 类不是以偏移量 0 处的 vfptr 开头!有时它们以 vbptr …
Is there a way to include STL without having things defined in the global scope like ::size_t
? Implementation items like _security_init_cookie
are fine with me, as their identifiers are reserved.
vcruntime.h
is always included and this bothers me.
我卸载了python3.4并安装了python3.9.2。现在pip
不行了。python3 -m pip install
显示以下错误
Traceback (most recent call last):
File "/usr/local/lib/python3.9/subprocess.py", line 73, in <module>
import msvcrt
ModuleNotFoundError: No module named 'msvcrt'
Run Code Online (Sandbox Code Playgroud)
简单的Python代码正在运行。我的操作系统是 openSUSE Leap 42.3。我安装了另一个python2.7。任何帮助将不胜感激。
我一直有以下形式的链接器错误:
libcmtd.dll msvmrtd.dll 已经定义了一些元素(例如:_mkdir) ...
我不知道如何解决它们.
这是一个完整的错误消息:
private:__ thiscall type_info :: type_info(class type_info const&)"(?? 0type_info @@ AAE @ ABV0 @@ Z)已在LIBCMTD.lib(typinfo.obj)中定义
MSVCRTD.lib(ti_inst.obj):错误LNK2005:已在LIBCMTD.lib中定义的"private:class type_info&__thiscall type_info :: operator =(class type_info const&)"(?? 4type_info @@ AAEAAV0 @ ABV0 @@ Z) (typinfo.obj)
你能帮我解决这个问题吗?
对不起,如果有人询问.
就像我可以在C#项目中选择我希望它为.NET 2.0运行时构建一样,是否有可能针对旧版CRT构建本机c ++项目,让我们说来自visual studio 2005?
我想这是因为我有使用VS2005构建的外部SDK,但我想使用更新的IDE.
我想问一下msvcr100与msvcrt相比是否有优势,优势是什么?
使用msvc编译器进行编译时,我得到的可执行文件链接到msvcr100,因此需要安装MS Visual C++ Redistributable.如果我用g ++(mingw)编译它,那么没有这样的要求.我猜它与msvcrt相关联,而不是.
我更喜欢将依赖关系保持在最低限度,所以我想知道使用链接到mscvr100的编译器是否有任何意义.
谢谢.
我的代码如下:
import msvcrt
while True:
if msvcrt.getch() == 'q':
print "Q was pressed"
elif msvcrt.getch() == 'x':
sys.exit()
else:
print "Key Pressed:" + str(msvcrt.getch()
Run Code Online (Sandbox Code Playgroud)
此代码基于此问题 ; 我用它来熟悉自己getch
.
我注意到按3次键需要3次输出文本一次.为什么是这样?我正在尝试将它用作事件循环,这太过于滞后......
即使我键入3个不同的键,它也只输出第3个按键.
我怎么能强迫它走得更快?有没有更好的方法来实现我想要实现的目标?
谢谢!
evamvid
.386
.model flat, c
.stack 100h
printf PROTO arg1:Ptr Byte
.data
msg1 byte "Hello World!", 0Ah, 0
.code
main proc
INVOKE printf, ADDR msg1
ret
main endp
end main
Run Code Online (Sandbox Code Playgroud)
嗨,我收到以下错误:
我四处搜索,发现有人说可以通过链接微软运行时库来修复它
任何人都可以教我如何才能完全解决它?
谢谢
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _printf referenced in function _main testing C:\Users\Kin\Desktop\assembly\testing\testing\Source.obj 1
Error LNK1120 1 unresolved externals testing C:\Users\Kin\Desktop\assembly\testing\Debug\testing.exe 1
Run Code Online (Sandbox Code Playgroud) msvcrt ×10
c++ ×5
python ×3
visual-c++ ×3
windows ×2
assembly ×1
c ×1
crt ×1
event-loop ×1
getch ×1
masm ×1
pip ×1
python-2.7 ×1
python-3.x ×1
pywin32 ×1
rtti ×1
vptr ×1
x86 ×1