2008-04-08から1日間の記事一覧

dllを呼び出す

今作ったfoo.dllをRubyから呼び出してみる require 'dl/win32' puts Win32API.new('foo.dll','foo','i','i').call(1) s='Fizz' Win32API.new('foo.dll','bar','p').call(s) puts s実行結果 2 Buzzこっちはちゃんとsの内容が書き換わった。

dllを呼び出す

VBA

今作ったfoo.dllをExcelから呼び出してみる Declare Function foo Lib "D:\dll\foo.dll" (ByVal x As Integer) As Integer Declare Sub bar Lib "D:\dll\foo.dll" (ByVal s As String)イミディエイトウインドウでテスト ? foo(1) 2 s="Fizz" bar(s) ? s Fizz…

dllの作り方

ソースファイルfoo.c __declspec(dllexport) int __stdcall foo(int x){ return x+1; } __declspec(dllexport) void __stdcall bar(char *s){ s[0]='B'; s[1]='u'; }defファイルfoo.def これがなくてもdllは作れるが関数名が_foo@4とかになってしまう LIBRAR…

依存dllの調べ方

dll

$ objdump -x vc8test.exe | grep 'DLL Name' DLL Name: MFC80.DLL DLL Name: MSVCR80.dll DLL Name: KERNEL32.dll dll単体のダウンロード http://www.dll-files.com/dllindex/pop.php?msvcr80 http://www.dll-files.com/dllindex/pop.php?mfc80 が、vc2005…