- #!evn ruby
- require 'rubygems'
- require 'dl'
- require 'Win32API'
- #dll文件名
- dllname = 'mm.dll'
- #dll里的函数名
- method_name = 'convert'
- #string buff
- buff = 1.chr * 222
- s = 'abc'
- a =Win32API.new(dllname , method_name , 'PP','v')
- a.call(s,buff)
- #<a href="http://www.CodeSnippet.Cn">http://www.CodeSnippet.Cn
- #C : 字符 (char)
- #c : 指向字符的指针 (char *)
- #H : short 整数 (short)
- #h : 指向short整数的指针 (short *)
- #I : 整数 (char, short, int)
- #i : 指向整数的指针 (char *, short *, int *)
- #L : long 整数 (long)
- #l : 指向long整数的指针 (long *)
- #F : 实数 (float)
- #f : 指向实数的指针 (float *)
- #D : 实数 (double)
- #d : 指向实数的指针(double *)
- #S : 不可变(immutable)字符串 (const char *)
- #s : 可变(mutable)字符串 (char *)
- #A : 数组(const type[])
- #a : 可变(mutable)数组 (type[])
- #P : 指针 (void *)
- #p : 可变(mutable)指针 (void *)
- #0 : void 函数(必须是原型的首字符)
- #该片段来自于http://www.codesnippet.cn/detail/140520133324.html
来源: http://www.codesnippet.cn/detail/140520133324.html