1

我正在迁移到 Windows 7,进入Slickedit 17 64 位,并有一个旧的 32 位 Slickedit 扩展 DLL,我需要将其重新创建为 64 位。这个 DLL 基本上是一堆 WinAPI 调用的包装器。

Slickedit 附带一个示例 32 位“simple.dll”项目 (ahem),它只是一个 makefile。我需要知道如何设置 Visual Studio 项目以使用 Slickedits 库构建 64 位 DLL。

提供的makefile如下:

# This makefile supports the following Visual C++ versions: 
# 7.10 (Visual Studio 2003), 8.00 (Visual Studio 2005),
# and 9.00 (Visual Studio 2008)
#
# Nmake macros for building Windows 32-Bit apps
!include <Win32.mak>

# Set linkdebug to nothing to link DLL without debug
#linkdebug=

DLLNAME=simple
cflags=$(cflags) -D_WINDOWS -I..\..\h

all: $(DLLNAME).lib $(DLLNAME).dll

# Update the object files if necessary

$(DLLNAME).obj: $(DLLNAME).cpp
    $(cc) $(cflags) $(cvarsmt) $(cdebug) -Tp $*.cpp

# Update the import library

$(DLLNAME).lib: $(DLLNAME).obj $(DLLNAME).def
    $(implib) -machine:$(CPU) \
    -def:$(DLLNAME).def $*.obj -out:$*.lib

# Update the dynamic link library

LIBDIR=lib
$(DLLNAME).dll: $(DLLNAME).obj $(DLLNAME).def makefile
    $(link) $(linkdebug) \
    -NODEFAULTLIB:libc -base:0x1C000000  \
    -dll -entry:_DllMainCRTStartup$(DLLENTRY) \
    -out:$*.dll  \
    $*.exp $*.obj ..\..\$(LIBDIR)\dllmain.obj ..\..\$(LIBDIR)\vsapi.lib ..\..\$(LIBDIR)\secommon.lib $(conlibsmt)

clean :
    del $(DLLNAME).dll $(DLLNAME).obj $(DLLNAME).pdb $(DLLNAME).ilk

Makefiles 不是我的东西,而且无论如何这个设置为 32 位。那么如何设置一个 Studio 项目来处理这种类型的 C++ 构建。我有:

  • C:\se17\lib\dllmain.obj
  • C:\se17\lib\secommon.lib
  • C:\se17\lib\tagsdb.lib
  • C:\se17\lib\vsapi.lib

以及 C:\se17\h 中提供的头目录

我之所以这么问,是因为我对在 community.slickedit.com 上获得体面的回应持怀疑态度,无论如何上帝都爱他们

4

1 回答 1

1

You need to tell the linker that your DLL target is 64-bit. That's done by /MACHINE:X64 on the linker line. I'd just add it afer "$(linkdebug)".

You will also need to set the compiler to point to the amd64 version, which is explained in this question: How do you compile 32-bit and 64-bit applications at the same time in Visual Studio for C/C++ in a makefile?

于 2012-12-29T22:19:28.850 回答