2010-07-21 108 views
0

我引用的文件是在這裏,而且非常簡短,扼要兼容的C DLL: http://livedocs.adobe.com/en_US/Dreamweaver/9.0_API/help.html?content=dwr_sourcecontrol_so_01.html建築用Dreamweaver

我遇到的問題是,我不知道如何編譯實際DLL。 adobe擴展論壇上的最後一個回覆是3個月前的版本,我不確定該回答這個問題。

,混淆我編程的是,我必須建立與C++的DLL,但大多數教程做工基礎上構建的目標應用包括一個頭文件。 (我對DLL編程更新。)Dreamweaver只需要一個DLL,它已經知道它將調用什麼。我對我怎麼樣可以把單獨的DLL文件此信息混亂,雖然基於自上應用我已經閱讀教程似乎也需要頭文件或庫文件。

對於我的第一次嘗試我用VS2008和選擇的Win32 DLL我的項目類型,然後在導出的函數文件時,它產生我添加了必需的功能。我的第一個如下:

extern "C" __declspec(dllexport) bool SCS_Connect(void **connectionData, const char siteName[64]) 
{ 
return true; 
} 

任何人都可以幫助澄清如何這可能工作?

編輯: 重讀我注意到它說的文檔:

Dreamweaver中確定哪些通過調用 GetProcAddress的()爲每個API 功能設有 的庫支持。如果地址不存在 ,Dreamweaver會假定庫 不支持API。如果 地址存在,Dreamweaver使用 庫的版本的功能,以支持 的功能。

雖然我仍然不確定這是什麼意思,我的編譯的DLL。

編輯2: 的Dependency Walker退換:

LoadLibraryW("c:\program files\adobe\adobe dreamweaver cs3\Configuration\SourceControl\mercFlow.dll") returned 0x05110000. 
GetProcAddress(0x05110000 [MERCFLOW.DLL], "MM_InitWrapper") called from "DREAMWEAVER.EXE" at address 0x00D73D4B and returned NULL. Error: The specified procedure could not be found (127). 
GetProcAddress(0x05110000 [MERCFLOW.DLL], "SCS_GetAgentInfo") called from "DREAMWEAVER.EXE" at address 0x00D73D66 and returned NULL. Error: The specified procedure could not be found (127). 
GetProcAddress(0x05110000 [MERCFLOW.DLL], "SCS_GetNumNewFeatures") called from "DREAMWEAVER.EXE" at address 0x00D73D72 and returned NULL. Error: The specified procedure could not be found (127). 
GetProcAddress(0x05110000 [MERCFLOW.DLL], "SCS_GetNewFeatures") called from "DREAMWEAVER.EXE" at address 0x00D73D7E and returned NULL. Error: The specified procedure could not be found (127). 
GetProcAddress(0x05110000 [MERCFLOW.DLL], "SCS_Connect") called from "DREAMWEAVER.EXE" at address 0x00D73E2B and returned NULL. Error: The specified procedure could not be found (127). 

一對夫婦的這些都是在我的DLL中定義(有些是可選擇根據文檔),但都沒有找到。這是否意味着我的功能沒有被導出?

這裏是我的DLL來源:

dllheader.h

#ifndef DLLHEADER_H_INCLUDED 
#define DLLHEADER_H_INCLUDED 
#ifdef DLL_EXPORT 
# define EXPORT extern "C" __declspec (dllexport) 
#else 
# define EXPORT 
#endif 
DLL_EXPORT struct itemInfo; 
DLL_EXPORT bool SCS_GetAgentInfo(char name[32],char version[32], char description[256], const char * dwAppVersion); 
DLL_EXPORT bool SCS_Connect(void **connectionData, const char siteName[64]); 
DLL_EXPORT bool SCS_Disconnect(void *connectionData); 
DLL_EXPORT bool SCS_IsConnected(void *connectionData); 
DLL_EXPORT int SCS_GetRootFolder_Length(void *connectionData); 
DLL_EXPORT int SCS_GetFolderListLength(void *connectionData, const char *remotePath); 
DLL_EXPORT bool SCS_GetFolderList(void *connectionData, const char *remotePath, itemInfo itemList[ ], const int numItems); 
DLL_EXPORT bool SCS_Get(void *connectionData, const char *remotePathList[], const char *localPathList[], const int numItems); 
DLL_EXPORT bool SCS_Put(void *connectionData, const char *localPathList[], const char *remotePathList[], const int numItems); 
DLL_EXPORT bool SCS_NewFolder(void *connectionData,const char *remotePath); 
DLL_EXPORT bool SCS_Delete(void *connectionData, const char *remotePathList[],const int numItems); 
DLL_EXPORT bool SCS_Rename(void *connectionData, const char * oldRemotePath, const char*newRemotePath); 
DLL_EXPORT bool SCS_ItemExists(void *connectionData,const char *remotePath); 
#endif 

的main.cpp

#define DLL_EXPORT 
#include "dllheader.h" 
#include <iostream> 
char* const gName="MercFlow"; 
char* const gVersion="1.0"; 
char* const gDescription="Native Mercurial Support for Dreamweaver."; 


DLL_EXPORT struct itemInfo 
{ 
    bool isFolder; 
    int month; 
    int day; 
    int year; 
    int hour; 
    int minutes; 
    int seconds; 
    char type[256]; 
    int size; 
}; 


// Description: This function asks the DLL to return its name and description, which appear in the Edit Sites dialog box. The name appears in the Server Access pop-up menu (for example, sourcesafe, webdav, perforce) and the description below the pop-up menu. 
// name: The name argument is the name of the source control system. The name appears in the combo box for selecting a source control system on the Source Control tab in the Edit Sites dialog box. The name can be a maximum of 32 characters. 
DLL_EXPORT bool SCS_GetAgentInfo(char name[32],char version[32], char description[256], const char * dwAppVersion) 
{ 
    name=gName; 
    version=gVersion; 
    description=gDescription; 
    return true; 
} 
//Description: This function connects the user to the source control system. If the DLL does not have log-in information, the DLL must display a dialog box to prompt the user for the information and must store the data for later use. 
DLL_EXPORT bool SCS_Connect(void **connectionData, const char siteName[64]) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_Disconnect(void *connectionData) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_IsConnected(void *connectionData) 
{ 
    return true; 
} 
DLL_EXPORT int SCS_GetRootFolder_Length(void *connectionData) 
{ 
    return 0; 
} 
DLL_EXPORT bool SCS_GetRootFolder(void *connectionData, char remotePath[],const int folderLen) 
{ 
    return true; 
} 
DLL_EXPORT int SCS_GetFolderListLength(void *connectionData, const char *remotePath) 
{ 
    return 0; 
} 
DLL_EXPORT bool SCS_GetFolderList(void *connectionData, const char *remotePath, itemInfo itemList[ ], const int numItems) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_Get(void *connectionData, const char *remotePathList[], const char *localPathList[], const int numItems) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_Put(void *connectionData, const char *localPathList[], const char *remotePathList[], const int numItems) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_NewFolder(void *connectionData,const char *remotePath) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_Delete(void *connectionData, const char *remotePathList[],const int numItems) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_Rename(void *connectionData, const char * oldRemotePath, const char*newRemotePath) 
{ 
    return true; 
} 
DLL_EXPORT bool SCS_ItemExists(void *connectionData,const char *remotePath) 
{ 
    return true; 
} 
+1

目標應用程序只包含一個標題/鏈接一個自動鏈接的庫。通過GetProcAddress手動鏈接不需要anysuch-你可以在隨機DLL上調用GetProcAddress並查找函數。 – Puppy 2010-07-21 19:19:10

+0

當您嘗試編譯時會發生什麼,您是否收到錯誤消息? – torhu 2010-07-21 19:46:54

+0

編譯成功。我有一個非常容易的時間來編譯。它只是編譯它,所以Dreamweaver可以正確地看到這些功能。 – 2010-07-21 19:53:03

回答

1

根據該文件,你可能需要添加所有的Dreamwaver將接受你的DLL之前所需的函數。您可以使用Dependency Walker的個人資料模式時看到DW加載DLL你會發生什麼。還要驗證您的DLL是否真的導出了所有必需的符號。

編輯:在Dependency Walker的模塊樹或模塊列表中選擇您的DLL,然後查看右側的導出列表(它在第一列標題中說'E')並確保所有必需的函數都在那裏。如果GetProcessAddress在其中一個所需功能上失敗,則需要添加該功能。

+0

這是一個好主意,但我相信Dreamweaver使用延遲加載依賴模塊作爲Dependency Walker的調用模塊。爲API DLLs。直到我在Dreamweaver中找到站點>新站點時,錯誤(嘗試加載)纔會真正發生。 – 2010-07-21 20:24:48

+0

啊,我現在看到了。現在看它...我希望我能再次讓你滿意。這非常有幫助。 – 2010-07-21 20:28:25

+0

我剛剛編輯了我的回覆,希望這是在這裏做的事情的正確方法:) – torhu 2010-07-21 20:52:24