我已经将信发出了.由于我们的e-mail服务器很不稳定,我再把代码贴到这里.
我用BCB4做的一个DLL的工程,最后连接出的DLL只有45K,有输出函数Test
<h1>Dll.cpp</h1>
//---------------------------------------------------------------------------
#include <windows.h>
#pragma hdrstop
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
return 1;
}
//---------------------------------------------------------------------------
extern "C"{
//---------------------------------------------------------------------------
int WINAPI __export Test(int,int)
{
return 0;
}
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
<h1>dll.bpr</h1>
# ---------------------------------------------------------------------------
!if !$d(BCB)
BCB = $(MAKEDIR)/..
!endif
# ---------------------------------------------------------------------------
# IDE SECTION
# ---------------------------------------------------------------------------
# The following section of the project makefile is managed by the BCB IDE.
# It is recommended to use the IDE to change any of the values in this
# section.
# ---------------------------------------------------------------------------
VERSION = BCB.04.04
# ---------------------------------------------------------------------------
PROJECT = Dll.dll
OBJFILES = Dll.obj
RESFILES =
RESDEPEN = $(RESFILES)
LIBFILES =
IDLGENFILES =
IDLFILES =
LIBRARIES =
SPARELIBS =
PACKAGES = Vcl40.bpi Vclx40.bpi Vcldb40.bpi ibsmp40.bpi vcldbx40.bpi Qrpt40.bpi /
TeeUI40.bpi teedb40.bpi tee40.bpi Dss40.bpi Vclmid40.bpi NMFast40.bpi /
Inetdb40.bpi Inet40.bpi dclocx40.bpi bcbsmp40.bpi
DEFFILE =
# ---------------------------------------------------------------------------
PATHCPP = .;
PATHPAS = .;
PATHASM = .;
PATHRC = .;
DEBUGLIBPATH = $(BCB)/lib/debug
RELEASELIBPATH = $(BCB)/lib/release
USERDEFINES = _NO_VCL
SYSDEFINES = NO_STRICT
# ---------------------------------------------------------------------------
CFLAG1 = -I$(BCB)/include -WD -O2 -Hc -H=$(BCB)/lib/vcl40.csm -w -Ve -a8 -5 -d -k- -vi /
-c -b- -w-par -w-inl -Vx -tWM -D$(SYSDEFINES);$(USERDEFINES)
IDLCFLAGS = -I$(BCB)/include -src_suffixcpp -D_NO_VCL
PFLAGS = -U$(BCB)/lib;$(RELEASELIBPATH) -I$(BCB)/include -D_NO_VCL -$Y- -$L- -$D- -v /
-JPHNE -M
RFLAGS = -i$(BCB)/include -D_NO_VCL
AFLAGS = /i$(BCB)/include /d_NO_VCL /mx /w2 /zn
LFLAGS = -L$(BCB)/lib;$(RELEASELIBPATH) -aa -Tpd -x
# ---------------------------------------------------------------------------
ALLOBJ = c0d32.obj $(OBJFILES)
ALLRES = $(RESFILES)
ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib
# ---------------------------------------------------------------------------
!ifdef IDEOPTIONS
[Version Info]
IncludeVerInfo=0
AutoIncBuild=1
MajorVer=1
MinorVer=0
Release=0
Build=1
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=2052
CodePage=936
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.1
InternalName=
LegalCopyright=
LegalTrademarks=AGZ
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[HistoryLists/hlIncludePath]
Count=1
Item0=$(BCB)/include
[HistoryLists/hlLibraryPath]
Count=1
Item0=$(BCB)/lib
[HistoryLists/hlDebugSourcePath]
Count=1
Item0=$(BCB)/source/vcl
[HistoryLists/hlConditionals]
Count=1
Item0=_NO_VCL
[HistoryLists/hlIntOutputDir]
Count=1
Item0=
[Debugging]
DebugSourceDirs=
[Parameters]
RunParams=
HostApplication=
RemoteHost=
RemotePath=
RemoteDebug=0
[Compiler]
InMemoryExe=0
ShowInfoMsgs=0
[CORBA]
AddServerUnit=1
AddClientUnit=1
PrecompiledHeaders=1
!endif
# ---------------------------------------------------------------------------
# MAKE SECTION
# ---------------------------------------------------------------------------
# This section of the project file is not used by the BCB IDE. It is for
# the benefit of building from the command-line using the MAKE utility.
# ---------------------------------------------------------------------------
.autodepend
# ---------------------------------------------------------------------------
!if !$d(BCC32)
BCC32 = bcc32
!endif
!if !$d(CPP32)
CPP32 = cpp32
!endif
!if !$d(DCC32)
DCC32 = dcc32
!endif
!if !$d(TASM32)
TASM32 = tasm32
!endif
!if !$d(LINKER)
LINKER = ilink32
!endif
!if !$d(BRCC32)
BRCC32 = brcc32
!endif
!if !$d(IDL2CPP)
IDL2CPP = idl2cpp
!endif
# ---------------------------------------------------------------------------
!if $d(PATHCPP)
.PATH.CPP = $(PATHCPP)
.PATH.C = $(PATHCPP)
!endif
!if $d(PATHPAS)
.PATH.PAS = $(PATHPAS)
!endif
!if $d(PATHASM)
.PATH.ASM = $(PATHASM)
!endif
!if $d(PATHRC)
.PATH.RC = $(PATHRC)
!endif
# ---------------------------------------------------------------------------
$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)
$(BCB)/BIN/$(LINKER) @&&!
$(LFLAGS) +
$(ALLOBJ), +
$(PROJECT),, +
$(ALLLIB), +
$(DEFFILE), +
$(ALLRES)
!
# ---------------------------------------------------------------------------
.pas.hpp:
$(BCB)/BIN/$(DCC32) $(PFLAGS) {$< }
.pas.obj:
$(BCB)/BIN/$(DCC32) $(PFLAGS) {$< }
.cpp.obj:
$(BCB)/BIN/$(BCC32) $(CFLAG1) -n$(@D) {$< }
.c.obj:
$(BCB)/BIN/$(BCC32) $(CFLAG1) -n$(@D) {$< }
.c.i:
$(BCB)/BIN/$(CPP32) $(CFLAG1) -n. {$< }
.cpp.i:
$(BCB)/BIN/$(CPP32) $(CFLAG1) -n. {$< }
.asm.obj:
$(BCB)/BIN/$(TASM32) $(AFLAGS) $<, $@
.rc.res:
$(BCB)/BIN/$(BRCC32) $(RFLAGS) -fo$@ $<
# ---------------------------------------------------------------------------