• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            聚星亭

            吾笨笨且懶散兮 急須改之而奮進(jìn)
            posts - 74, comments - 166, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

                   SDK/angelscript/projects目錄中,您可以找到許多流行編譯器的相關(guān)項(xiàng)目文件(原文: In the sdk/angelscript/projects directory you'll find project files for many of the popular compilers)。不過,那些工程文件不一定是最新的腳本庫工程。(原文: these project files are not always up to date with the latest version of the library.)如果你有任何一個編譯或鏈接出錯,請弄清楚工程文件包含的所有文件所在的sdk/angelscript/source目錄(原文: If you get any compiler or linker errors please make sure the project file include all the files in the sdk/angelscript/source directory),并將工程按照本文件進(jìn)行設(shè)置(原文: and that the project settings are set according to this article.

            ,

                   如果你找不到符合你編譯器的工程文件,你可以通過添加sdk/angelscript/source目錄下的全部文件到你的工程,并且對項(xiàng)目作適當(dāng)?shù)呐渲茫ㄔ?/span>: If you don't find a project file for your compiler, you can easily create your own project by adding all the files in the sdk/angelscript/source directory, and configuring the project apropriately.)。

             

                   如果你有一個從沒使用過AngelScript的新編譯器,你可能需要編輯as_config.h文件以便合理的編譯本工程(If you have a new compiler/target that hasn't been used with AngelScript before, you may need to edit the as_config.h file to make sure the library is compiled properly. )。

             

            1.1.1.      編譯時的選項(xiàng)設(shè)置(Set compile time options

                   創(chuàng)建as_config.h頭文件是為了使本代碼盡可能的包含不同的編譯環(huán)境(原文: The code tries to contain compiler differences in as few places as possible. The header as_config.h was created for that purpose.)。為了支持不同的編譯器,你可能會發(fā)現(xiàn)一些 #defines 宏定義(There you will find some #defines that allow different compilers to work.)。這個文件一般情況下不需要修改,但是如果你用一個過舊的編譯器編譯出錯的話,可能就需要看一下這個文件了(原文: You'll probably not have to change this file, but if you're using a compiler not previously used and you're getting compiler errors it might be worth it to take a look at this file.)。

             

                當(dāng)在編譯這個庫時有一些 #defines 宏定義需要改寫,比如寫你應(yīng)該定義一個ANGELSCRIPT_EXPORT宏以便導(dǎo)出庫函數(shù)(原文: There are also a couple of other #defines used in the code to alter the compilation. When compiling the library you might want to define ANGELSCRIPT_EXPORT so that library functions are exported.)。當(dāng)然,如果在你的工程中包含了庫源代碼目錄的話就不用定義這個標(biāo)記了(If you include the library source code directly in your application project you shouldn't have to define this flag. )

             

                   如果定義了AS_DEPRECATED 則支持向后兼容,這就可以幫你更方便的更新到最新版本(If AS_DEPRECATED is defined then some backwards compatibility is maintained, this can help you do the upgrade to the latest version a little more smoothly.)。盡管不能保證支持向后兼容,但是應(yīng)盡可能的移除不支持的功能(There is no guarantee that the backwards compatibility will be maintained though so try to remove use of deprecated functions as soon as possible.)。

            1.1.2.      關(guān)聯(lián)腳本庫(Linking with the library)

                   有四種方法可以編譯并連接AngelScript(原文: There are four ways of compiling and linking with AngelScript in order to use it.),我推薦把它連接成靜態(tài)庫(原文: I recommend linking with a static library.)。請注意,你只需要少許改動代碼這四種方法就可以相互轉(zhuǎn)換了(原文:Note that all four ways are interchangable with only a small change in your code,),即 在包含頭文件之前先定義一個標(biāo)記,然后可能需要手工加載一個DLL(原文: i.e a defined flag before including the header file, and possibly a routine for manually loading the dll.)。【接下來按照下面提供的任何一種方案操作都一樣(原文: The rest of your code should look exactly the same for each of the alternatives.)。】

             

            1.在工程中包含腳本庫文件(原文: Include library source files in project

                   你可以直接在自己的工程中包含AngelScript源文件(原文:You can take the source files for AngelScript and include them directly in your own project.)。

            這樣的好處是可以保證腳本庫和宿主應(yīng)用程序都使用相同的編譯選項(xiàng)(原文:The advantage of this is that you can be sure that the same compiler options are used for the library and the host applications,),例如:CRT(應(yīng)該翻譯成C運(yùn)行時么?)是多線程還是單線程(原文: e.g. multi-threaded or single-threaded CRT.)。缺點(diǎn)就是你的工程將包含有庫文件(原文: The disadvantage is that your project will be poluted with the library files.)

            這些文件要使用這個腳本庫,可能需要包含angelscript.h頭再就不需要別的特殊設(shè)置了(原文: The files that need to use the library should include the angelscript.h header with no need for any special settings.)

            // Include the library interface

            #include "angelscript.h"

             

            // ... Start using the library

             

            2. 編譯一個靜態(tài)庫并連接到工程中(Compile a static library and link into project)

             

                   極力推薦把它編譯成一個靜態(tài)庫并連接到自己的工程中(原文: The most recommended way is to compile a static library that your project will link with.)。在編譯靜態(tài)庫的時候必須先設(shè)置好編譯選項(xiàng)以免與CRT功能項(xiàng)沖突(功能: When compiling the static library you have to make sure that the correct compiler settings are used so that you don't get conflicts in linkage with the CRT functions.)。例如:如果腳本庫使用動態(tài)鏈接多線程的CRT而你的應(yīng)用程序采用單線程的靜態(tài)鏈接CRT(原文: This happens if you for example compile the library with dynamically linked multi-threaded CRT and your application with statically linked single-threaded CRT.(VisualC++中可以在Project -> Settings -> C/C++ -> Category: Code Generation中設(shè)置這些)

                  

                   接下來,要使用腳本庫你只需要包含angelscript.h頭文件即可(原文: To use the library you only need to include the angelscript.h header file.)。

            // Include the library interface

            #include "angelscript.h"

             

            // ... Start using the library

             

            3. 編譯一個導(dǎo)入庫的動態(tài)鏈接庫Compile a dynamically loaded library with an import library

                   使用Microsoft Visual C + +就可以編譯導(dǎo)入庫動態(tài)加載庫(原文: With Microsoft Visual C++ it is possible to compile a dynamically loaded library with an import library.)。導(dǎo)入庫, 加載需要的DLL并綁定函數(shù)(原文: The import library will then take care of the work needed to load the dll and bind the functions.)。     這種方法可能存在缺點(diǎn),如果腳本庫加載失敗就沒有辦法給出友好的錯誤提示(原文:A possible disadvantage of this method is that you are not able to give any user-friendly error messages in case loading the library fails.

             

                   在包含angelscript.h頭文件之前定義個ANGELSCRIPT_DLL_MANUAL_IMPORT宏(原文:To use the library you'll have to define ANGELSCRIPT_DLL_LIBRARY_IMPORT before including the angelscript.h header file.)。

            // Include the library interface

            #define ANGELSCRIPT_DLL_LIBRARY_IMPORT

            #include "angelscript.h"

             

            // ... 開始使用腳本庫

             

            4. 手工載入動態(tài)連接庫(Load the dynamically loaded library manually

                   如果你想使用DLL,例如 在應(yīng)用程序之間共享代碼,我建議手工載入這個庫,這樣基本上所有的加載或綁定錯誤都可以得到緩解(原文: If you want to use a dll, e.g. to share code between applications, I recommend loading the library manually as you can treat any failures to load or bind functions graciously.)。

             

                   手工載入DLL,你可以在包含angelscript.h頭文件之前定義個ANGELSCRIPT_DLL_MANUAL_IMPORT宏(原文:To use manually loaded dll, you should define ANGELSCRIPT_DLL_MANUAL_IMPORT before including the header file.)。這樣可以確保在頭文件中不用聲明函數(shù)原型,同樣就可以通過函數(shù)指針來使用這些的名字(原文: This will insure that the header file doesn't declare the function prototypes, as you will most likely want to use these names for the function pointers.)。

            // Include the library interface

            #define ANGELSCRIPT_DLL_MANUAL_IMPORT

            #include "angelscript.h"

             

            // 聲明函數(shù)指針

            typedef asIScriptEngine * AS_CALL t_asCreateScriptEngine(int);

            t_asCreateScriptEngine *asCreateScriptEngine = 0;

             

            // ... 聲明其余函數(shù)

             

            //載入DLL并綁定函數(shù) (error handling left out for clarity)

            HMODULE dll = LoadLibrary("angelscript.dll");

            asCreateScriptEngine = (t_asCreateScriptEngine*)GetProcAddress(dll, "_asCreateScriptEngine");

            // 綁定其它函數(shù)

            // 使用本腳本庫

             

                                                                                                                    ---------  besterChen

                                                                                                                     譯于 201031日星期六

            久久99精品国产一区二区三区| 久久婷婷五月综合97色直播| 2021国产精品午夜久久| 偷窥少妇久久久久久久久| 2020国产成人久久精品| 精品久久久久久久久中文字幕| 精品人妻伦九区久久AAA片69| 伊人久久大香线蕉AV一区二区| 久久久久女人精品毛片| 激情综合色综合久久综合| 亚洲熟妇无码另类久久久| 亚洲成色999久久网站| 久久午夜无码鲁丝片秋霞| 国产精品无码久久综合网| 日韩人妻无码精品久久免费一| 久久精品中文字幕第23页| 69久久精品无码一区二区| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 久久国产精品成人影院| 国产99精品久久| 影音先锋女人AV鲁色资源网久久| 久久精品国产亚洲AV大全| 亚洲欧美一区二区三区久久| 99久久国产主播综合精品| 精品国产乱码久久久久久郑州公司| 精品久久久久中文字| 国产精品久久久久久影院| 久久精品国产亚洲AV无码麻豆| 四虎国产精品成人免费久久| 亚洲精品WWW久久久久久| 久久久久亚洲AV无码去区首| 2021国产成人精品久久| 亚洲综合精品香蕉久久网97| 久久精品国产亚洲AV香蕉| 久久国产精品无码HDAV| 97精品国产91久久久久久| 精品一区二区久久久久久久网站| 99国产欧美精品久久久蜜芽| 99精品国产在热久久无毒不卡 | 国内精品伊人久久久久AV影院| 青草国产精品久久久久久|