2010-07-21 116 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