[RM大富翁]Experimental Preview
2012 年 10 月 19 日
1.LLVM X TCC
clang作为C++前端的速度还是比gcc快那么一些的,嘛~而且人家是BSD-like的授权
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | $TEST=false if $TEST LTCC = "E:\llvmas\ltcc" def runcpp(cppcode) open("1.cpp", "w"){|f| f.write cppcode } system "#{LTCC} 1.cpp 1.exe" system "1.exe" end def getdll(cppcode, dllname) open("1.cpp", "w"){|f| f.write cppcode } system "cmd /c #{LTCC} 1.cpp #{dllname} -rdynamic -shared" end runcpp(" #include <windows.h> int main(){ MessageBox(0, "Hello", 0, 0); }") getdll(<<-'EOF', "mydll.dll") extern "C" int add(int a, int b){ return a+b; } EOF p Win32API.new('mydll.dll', 'add', 'ii', 'i').call(3, 5) end |