York Jong's Library tagged → View Popular
Python的進步: ctypes
大部份dll使用ctypes都可以應用得很好,像是我擔心的callback,ctypes一樣可以提供方法來把python的函數包裝成c語言的callback丟給c語言的dll,運作得很好
探訪動態連結函式庫
在Windows 下DLL 通 常 是 以 『 副 檔 名 為DLL 的 檔 案 』 存 在 ,DLL 內 可 以 包 含 提 供 外 部 呼 叫 的 函 式 、 資 源 (Resource ) 以 及各 種 的 變 數 , 當DLLs 被 應 用 程 式 載 入 時 這 些DLLs 內 含 的 資料 都 會 變 為 應 用 程 式 所 屬 行 程 的 一 部 份
-
tdump.exe 工 具 列 出 一
個DLL 檔內 所 有 的Section -
tdump inputfile outputfile
- 13 more annotations...
Borland C++ Builder - Lesson 06: Using Additional Libraries
A library is a group of functions, classes, or other resources that can be made available to programs that need already implemented entities without the need to know how these functions, classes, or resources were created or how they function.
-
There are two broad categories of libraries you will deal with in your programs:
static libraries and dynamic libraries. -
A static library created can be used by either a
console application, a Win32 application, or a VCL application. That's one
of its advantages - 7 more annotations...
StraceNT - Strace for Windows
StraceNT is a System Call Tracer for Windows. It provides similar functionality as of strace on Linux.
Stdcall and DLL tools of MSVC and MinGW
The __stdcall calling convention has been there for a very long time. While older calling conventions like __pascal fell into oblivion, __stdcall became the standard calling convention of Win32 API functions.
-
double __cdecl sin(double)
will be decorated as _sin, and double __stdcall sin(double)
will be decorated as _sin@8 -
The decorations could change when they
appear in DLLs or when they are produced by different compilers. - 1 more annotations...
Dependency Walker (depends.exe) Home Page
Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. For each module found, it lists all the functions that are exported by that module, and which of those functions are actually being called by other modules
-
For each module found, it lists all the functions that are exported by
that module, and which of those functions are actually being called by other modules
使用ctypes调用kernel32.dll中的函数
-
在Python中由ctypes实现。
class _PROCESS_INFORMATION(Structure):
_fields_ = [('hProcess', c_void_p),
('hThread', c_void_p),
('dwProcessId', c_ulong),
('dwThreadId', c_ulong)]
windows下面的python扩展-win32all 和ctypes
-
import win32api #winapi库
import win32con #windows常数定义win32api.MessageBox(win32con.NULL, "提示信息", "提示标题", win32con.MB_OK | win32con.MB_ICONINFORMATION)
输出一个messagbox,标题为"提示标题",提示文本为"提示信息",对话框图标为提示图标
-
import ctypes #cytpes库
import win32con #windows常数定义
msgbox = ctypes.windll.user32.MessageBoxA
msgbox(win32con.NULL, "提示信息", "提示标题", win32con.MB_OK | win32con.MB_ICONINFORMATION) - 2 more annotations...
Python调用windows下DLL详解
-
stdcall调用约定:两种加载方式
Objdll = ctypes.windll.LoadLibrary("dllpath")
Objdll = ctypes.WinDLL("dllpath")
cdecl调用约定:也有两种加载方式
Objdll = ctypes.cdll.LoadLibrary("dllpath")
Objdll = ctypes.CDLL("dllpath")
其实windll和cdll分别是WinDLL类和CDll类的对象
Selected Tags
Related Tags
Sponsored Links
Top Contributors
Groups interested in DLL
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo


