VS2010載入clutter動態連線庫DLL

2021-06-16 09:06:58 字數 2455 閱讀 1793

一,環境:

windows xp,microsoft visual studio 2010

二,所需檔案(clutter-1.4.2): 1,

clutter

動態連線庫(libclutter.dll)和由此庫生成的lib庫; 2,

clutter

標頭檔案; 3,

依賴庫標頭檔案及lib庫(glib、cairo、pango、atk、gl等);

工程名:clutter_test

工程路徑:e:\vs2010project

四,配置project properties

將lib資料夾拷貝到工程路徑下;

projectàclutter_test properties pageàconfiguration propertiesàc/c++àgeneralàadditional include directories,在後面輸入相關標頭檔案的路徑(e:\vs2010project\lib\include; e:\vs2010project\lib\include \cairo;……),使用分號間隔將所需標頭檔案路徑加入;(有時載入的不是dll,而是lib庫時,可以直接在……àlinkeràinputàadditional dependencies裡輸入相關的lib檔案),如:e:\vs2010project\lib\lib\glib-2.0.lib;e:\vs2010project\lib\lib\atk-1.0.lib;e:\vs2010project\lib\lib\cairo.lib;e:\vs2010project\lib\lib\fontconfig.lib;e:\vs2010project\lib\lib\freetype.lib;e:\vs2010project\lib\lib\gio-2.0.lib;e:\vs2010project\lib\lib\gmodule-2.0.lib;e:\vs2010project\lib\lib\intl.lib;e:\vs2010project\lib\lib\libpng.lib;e:\vs2010project\lib\lib\pangocairo-1.0.lib;e:\vs2010project\lib\lib\pangoft2-1.0.lib;e:\vs2010project\lib\lib\pangowin32-1.0.lib;e:\vs2010project\lib\lib\gthread-2.0.lib;e:\vs2010project\lib\lib\gtk-win32-2.0.lib;e:\vs2010project\lib\lib\gobject-2.0.lib;e:\vs2010project\lib\lib\libclutter.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(additionaldependencies);

將dll庫中的dll檔案拷貝到windows\system32目錄下,生成的執行檔案才可執行,也可修改環境變數到dll庫檔案所在目錄(我的電腦→屬性→高階—>環境變數-àpath)。

五,**(以下是直接在**中動態載入dll檔案,如有lib檔案,省去)

1,在**前加標頭檔案#include

2,載入動態連線庫libclutter.dll:

hinstance hdll; //

定義dll

檔案控制代碼

hdll=loadlibrary(l"libclutter.dll");//

載入.dll

,記得引號前要加l

3,  載入成功後,對於庫里的函式需重新讀取函式位址才能正常使用,例如使用

clutter_texture_new_from_file(),需進行如下操作方能使用:

typedef clutteractor* (winapiv *clutter_texture_new_from_file)(char*, char*);

clutter_texture_new_from_file clutter_texture_new_from_file;

clutter_texture_new_from_file=(clutter_texture_new_from_file)getprocaddress(hdlldrv, "clutter_texture_new_from_file");

actor_image=clutter_texture_new_from_file("eris1.png", null);

對於資料型別和類,均可正常使用,如:

clutteractor *actor_image;

clutterstage *stage;

cluttercontainer *container=(cluttercontainer *)stage;

如果出現類似clutter-test.obj : error lnk2001: unresolved external symbol的錯誤,可能就是由於沒有重新定義導致的。

如何提高VS2010的效能,VS2010不再卡

教大家幾個技巧可以稍微讓你覺得它沒那麼卡!一 vs2010選項視覺體驗設定 工具 選項 環境 視覺體驗的勾選都去掉。不解釋,你懂得。不過還是建議開啟硬體加速 二 禁用intellisense 工具 選項 文字編輯器 c c 高階 禁用intellisense設為true 這個功能很好用。相較於vis...

vs2010 利用python 載入並除錯dll

dll除錯是個麻煩事,如果專門寫乙個exe去除錯dll比較麻煩,現在提供乙個利用python指令碼除錯dll的辦法。環境要求 python 2.7.14 32位 vs2010 vs2010 新建乙個dll工程,命名為test.dll,其中有乙個匯出函式test,使用def檔案匯出 exports t...

VS2010恢復預設

xx處為你的使用者名稱 這個檔案儲存著ms的配置檔案,比如說opencv或者wincap的時候,像我一樣悲劇把配置搞亂的話,就重新改一下吧 vcinstalldir bin windowssdkdir bin netfx 4.0 tools windowssdkdir bin vsinstalldi...