我所引用的文档就在这里,而且相当简短: http://livedocs.adobe.com/en_US/Dreamweaver/9.0_API/help.html?content=dwr_sourcecontrol_so_01.html
我遇到的问题是我不确定如何编译实际的DLL。关于adobe扩展论坛的最后一个回复是3个月,我不知道该把这个问题放在哪里。
令我困惑的编程部分是我必须使用C ++构建DLL,但大多数教程的工作基于构建目标应用程序包含的头文件。 (我是DLL编程的新手。)Dreamweaver只需要一个DLL,它已经知道它将调用什么。我很困惑如何将这些信息单独放在DLL文件中,虽然基于我读过的教程,因为应用程序似乎也需要头文件或lib文件。
我第一次尝试使用VS2008并为我的项目类型选择了win32 DLL,然后在它生成的导出函数文件中添加了所需的函数。我的第一个是:
extern "C" __declspec(dllexport) bool SCS_Connect(void **connectionData, const char siteName[64])
{
return true;
}
任何人都可以帮助澄清这可能如何起作用吗?
修改 重读文档,我注意到它说:
Dreamweaver确定哪些功能 该库通过调用支持 每个API的GetProcAddress() 功能。如果地址没有 存在,Dreamweaver假定库 不支持API。如果 地址存在,Dreamweaver使用 库的函数版本 支持功能。
虽然我仍然不确定这对我编译DLL的意义。
编辑2: 返回的依赖步行者:
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;
}
答案 0 :(得分:1)
根据文档,您可能需要在Dreamwaver接受您的DLL之前添加所有必需的函数。您可以使用Dependency Walker的配置文件模式来查看DW加载DLL时会发生什么。并且还要验证您的DLL确实导出了所有必需的符号。
编辑:在Dependency Walker的模块树或模块列表中选择您的DLL,然后查看右侧的导出列表(在第一列标题中显示为“E”),并确保所有必需的功能都在那里。如果GetProcessAddress在其中一个必需的函数上失败,则需要添加该函数。