Alchemy环境的搭建
使用Alchemy,可以用C/C++开发Flash库,这样做的好处:
(1)高性能。比as3性能高,但比c/c++要低。adobe承诺下个版本的Alchemy可以达到C/C++性能的80%。拭目以待吧。
(2)同一份代码基础可以用于多个项目,非Flash项目也能够用;
(3)不用操心加密和混淆,破解难度比用as3写的要大。
====
主要参考这篇文章:《Adobe Alchemy 资料整理》:
1. Cygwin
a) Archive---------select ‘zip’
b) Devel-----------select ‘gcc-g++’
c) Perl--------------choose ‘install’
2. JDK
3. Flex SDK 3.2
4. Alchemy Toolkit
5. Copy ‘Flex Builder 3\sdks\3.2.0\bin’ to ‘c:\flex\bin’
6. Edit ‘c:\cygwin\etc\profile’
source /cygdrive/c/alchemy/alchemy-setup
PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/alchemy/achacks:/cygdrive/c/flex/bin:$PATH
7. Open ‘cygwin’, input ’cd c:/alchemy’
8. Input ‘./config’
9. Input ‘source /cygwin/c/alchemy/alchemy-setup’
10. Input ‘alc-on’
11. Close ‘cygwin’
12. (Optional) edit ‘c:\alchemy\alchemy-setup’
Change
‘#export ADL=/path/to/fyou/bin/adl (or adl.exe)’
To
‘export ADL=/cygdrive/c/flex/bin/adl.exe’
13. (Optional) edit ‘c:\cygwin\etc\bash.bashrc’
Add
‘source /cygdrive/c/alchemy/alchemy-setup
PATH=$ALCHEMY_HOME/achacks:/cygdrive/c/flex/bin:$PATH
export PATH’
14. Edit ‘c:\alchemy\achacks\hacks.pl’
Change
‘if (‘uname’=~/CYGWIN/)’
To
‘if (‘/bin/uname’=~/CYGWIN/)’
15. Edit ‘c:\cygwin\Cygwin.bat’
‘@echo off
C:
set CYGWIN=tty notitle glob
set
PATH=%PATH%;c:\cygwin\bin;c:\cygwin\sbin;c:\cygwin\usr\bin;c:\cygwin\usr\sbin;c:\cygwin\usr\local\bin
set LD_LIBRARY_PATH=c:\cygwin\lib;c:\cygwin\usr\lib;c:\cygwin\usr\local\lib
chdir C:\cygwin\bin
bash –login -i’
16. Open ‘cygwin’, input ‘cd /cygdrive/c/alchemy/samples/stringecho/’
17. Input ‘alc-on’
18. Input ‘gcc stringecho.c –O3 –Wall –swc –o stringecho.swc’
19. Flex use:
var loader:CLibInit = new CLibInit;
var lib:Object = loader.init();
trace(lib.echo(“foo”));
如果提示找不到 llvm-stub.exe,进入alchemy的bin目录,ln一下:
ln -s llvm-stub llvm-stub.exe
版权所有,欢迎转载