从 32 位 DLL 访问 64 位 DLL
Access 64 bit DLL from 32 bit DLL
我正在将 CEF4Delfi 库移植到 Borland C++Builder 5。我从移植的 CEF4Delfi 源代码制作了一个 BPL 包,并从我的 C++Builder 5 代码中引用它。
我在 Windows 10 64 位上工作。
在移植时,我卡在了导入 DLL 函数上。
这是导入的一部分:
const
Kernel32DLL = 'kernel32.dll';
SHLWAPIDLL = 'shlwapi.dll';
NTDLL = 'ntdll.dll';
User32DLL = 'User32.dll';
function ProcessUnderWow64(hProcess: THandle; Wow64Process: PBOOL): BOOL; stdcall; external Kernel32DLL name 'IsWow64Process';
function PathIsRelativeAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeA';
function PathIsRelativeUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeW';
function GetGlobalMemoryStatusEx(lpBuffer: LPMEMORYSTATUSEX): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
function PathCanonicalizeAnsi(pszBuf: LPSTR; pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeA';
function PathCanonicalizeUnicode(pszBuf: LPWSTR; pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeW';
function PathIsUNCAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCA';
function PathIsUNCUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCW';
function PathIsURLAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLA';
function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW';
function ShutdownBlockReasonCreate(hWnd: HWND; Reason: LPCWSTR): Bool; stdcall; external User32DLL;
function ShutdownBlockReasonDestroy(hWnd: HWND): Bool; stdcall; external User32DLL;
由于链接,我收到如下错误:
Error: Unresolved external 'PathIsRelativeA' referenced from C:\REPOS\CEF4DELPHI\SOURCE\UCEFMISCFUNCTIONS.OBJ
Error: Unresolved external 'AlphaBlend' referenced from C:\REPOS\CEF4DELPHI\SOURCE\UCEFBUFFERPANEL.OBJ
Error: Unresolved external 'IsWow64Process' referenced from C:\REPOS\CEF4DELPHI\SOURCE\UCEFMISCFUNCTIONS.OBJ
这是来自 C++Builder 的临时 MAKE0000.@@@
链接文件:
-D"" -aa -Tpp -x -Gn -Gl -Gi -v -L..\source;..\packages;..\packages\res;..\addons;..\winlib;c:\windows\system32;L:\Lib;T:\bin\..\lib\obj;T:\bin\..\lib; +
c0pkg32.obj vcl50.bpi Memmgr.Lib sysinit.obj ..\addons\MaxiSysUtils.obj ..\source\uCEFAccessibilityHandler.obj ..\source\uCEFApp.obj ..\source\uCEFApplication.obj ..\source\uCEFApplicationCore.obj ..\source\uCEFAudioHandler.obj ..\source\uCEFAuthCallback.obj ..\source\uCEFBaseRefCounted.obj ..\source\uCEFBaseScopedWrapper.obj ..\source\uCEFBeforeDownloadCallback.obj ..\source\uCEFBinaryValue.obj ..\source\uCEFBitmapBitBuffer.obj ..\source\uCEFBoxLayout.obj ..\source\uCEFBrowser.obj ..\source\uCEFBrowserProcessHandler.obj ..\source\uCEFBrowserView.obj ..\source\uCEFBrowserViewComponent.obj ..\source\uCEFBrowserViewDelegate.obj ..\source\uCEFBufferPanel.obj ..\source\uCEFButton.obj ..\source\uCEFButtonComponent.obj ..\source\uCEFButtonDelegate.obj ..\source\uCEFCallback.obj ..\source\uCEFChromium.obj ..\source\uCEFChromiumCore.obj ..\source\uCEFChromiumEvents.obj ..\source\uCEFChromiumFontOptions.obj ..\source\uCEFChromiumOptions.obj ..\source\uCEFChromiumWindow.obj ..\source\uCEFClient.obj ..\source\uCEFCommandLine.obj ..\source\uCEFCompletionCallback.obj ..\source\uCEFConstants.obj ..\source\uCEFContextMenuHandler.obj ..\source\uCEFContextMenuParams.obj ..\source\uCEFCookieAccessFilter.obj ..\source\uCEFCookieManager.obj ..\source\uCEFCookieVisitor.obj ..\source\uCEFCustomStreamReader.obj ..\source\uCEFDeleteCookiesCallback.obj ..\source\uCEFDevToolsMessageObserver.obj ..\source\uCEFDialogHandler.obj ..\source\uCEFDictionaryValue.obj ..\source\uCEFDisplay.obj ..\source\uCEFDisplayHandler.obj ..\source\uCEFDomDocument.obj ..\source\uCEFDomNode.obj ..\source\uCEFDomVisitor.obj ..\source\uCEFDownLoadItem.obj ..\source\uCEFDownloadHandler.obj ..\source\uCEFDownloadImageCallBack.obj ..\source\uCEFDownloadItemCallback.obj ..\source\uCEFDragAndDropMgr.obj ..\source\uCEFDragData.obj ..\source\uCEFDragHandler.obj ..\source\uCEFEndTracingCallback.obj ..\source\uCEFExtension.obj ..\source\uCEFExtensionHandler.obj ..\source\uCEFFileDialogCallback.obj ..\source\uCEFFillLayout.obj ..\source\uCEFFindHandler.obj ..\source\uCEFFocusHandler.obj ..\source\uCEFFrame.obj ..\source\uCEFFrameHandler.obj ..\source\uCEFGetExtensionResourceCallback.obj ..\source\uCEFImage.obj ..\source\uCEFInterfaces.obj ..\source\uCEFJsDialogCallback.obj ..\source\uCEFJsDialogHandler.obj ..\source\uCEFJson.obj ..\source\uCEFKeyboardHandler.obj ..\source\uCEFLabelButton.obj ..\source\uCEFLabelButtonComponent.obj ..\source\uCEFLayout.obj ..\source\uCEFLibFunctions.obj ..\source\uCEFLifeSpanHandler.obj ..\source\uCEFLinkedWinControlBase.obj ..\source\uCEFLinkedWindowParent.obj ..\source\uCEFListValue.obj ..\source\uCEFLoadHandler.obj ..\source\uCEFMediaObserver.obj ..\source\uCEFMediaRoute.obj ..\source\uCEFMediaRouteCreateCallback.obj ..\source\uCEFMediaRouter.obj ..\source\uCEFMediaSink.obj ..\source\uCEFMediaSinkDeviceInfoCallback.obj ..\source\uCEFMediaSource.obj ..\source\uCEFMenuButton.obj ..\source\uCEFMenuButtonComponent.obj ..\source\uCEFMenuButtonDelegate.obj ..\source\uCEFMenuButtonPressedLock.obj ..\source\uCEFMenuModel.obj ..\source\uCEFMenuModelDelegate.obj ..\source\uCEFMiscFunctions.obj ..\source\uCEFNavigationEntry.obj ..\source\uCEFNavigationEntryVisitor.obj ..\source\uCEFOAuth2Helper.obj ..\source\uCEFOLEDragAndDrop.obj ..\source\uCEFOSRIMEHandler.obj ..\source\uCEFOverlayController.obj ..\source\uCEFPDFPrintCallback.obj ..\source\uCEFPDFPrintOptions.obj ..\source\uCEFPanel.obj ..\source\uCEFPanelComponent.obj ..\source\uCEFPanelDelegate.obj ..\source\uCEFPostData.obj ..\source\uCEFPostDataElement.obj ..\source\uCEFPrintDialogCallback.obj ..\source\uCEFPrintHandler.obj ..\source\uCEFPrintJobCallback.obj ..\source\uCEFPrintSettings.obj ..\source\uCEFProcessMessage.obj ..\source\uCEFRegistration.obj ..\source\uCEFRenderHandler.obj ..\source\uCEFRenderProcessHandler.obj ..\source\uCEFRequest.obj ..\source\uCEFRequestContext.obj ..\source\uCEFRequestContextHandler.obj ..\source\uCEFRequestHandler.obj ..\source\uCEFResolveCallback.obj ..\source\uCEFResourceBundle.obj ..\source\uCEFResourceBundleHandler.obj ..\source\uCEFResourceHandler.obj ..\source\uCEFResourceReadCallback.obj ..\source\uCEFResourceRequestHandler.obj ..\source\uCEFResourceSkipCallback.obj ..\source\uCEFResponse.obj ..\source\uCEFResponseFilter.obj ..\source\uCEFRunContextMenuCallback.obj ..\source\uCEFRunFileDialogCallback.obj ..\source\uCEFSSLStatus.obj ..\source\uCEFSchemeHandlerFactory.obj ..\source\uCEFSchemeRegistrar.obj ..\source\uCEFScrollView.obj ..\source\uCEFScrollViewComponent.obj ..\source\uCEFSelectClientCertificateCallback.obj ..\source\uCEFSentinel.obj ..\source\uCEFServer.obj ..\source\uCEFServerComponent.obj ..\source\uCEFServerEvents.obj ..\source\uCEFServerHandler.obj ..\source\uCEFSetCookieCallback.obj ..\source\uCEFSslInfo.obj ..\source\uCEFStreamReader.obj ..\source\uCEFStreamWriter.obj ..\source\uCEFStringList.obj ..\source\uCEFStringMap.obj ..\source\uCEFStringMultimap.obj ..\source\uCEFStringVisitor.obj ..\source\uCEFTask.obj ..\source\uCEFTaskRunner.obj ..\source\uCEFTextfield.obj ..\source\uCEFTextfieldComponent.obj ..\source\uCEFTextfieldDelegate.obj ..\source\uCEFThread.obj ..\source\uCEFTimerWorkScheduler.obj ..\source\uCEFTypes.obj ..\source\uCEFUrlRequest.obj ..\source\uCEFUrlRequestClientComponent.obj ..\source\uCEFUrlRequestClientEvents.obj ..\source\uCEFUrlrequestClient.obj ..\source\uCEFValue.obj ..\source\uCEFView.obj ..\source\uCEFViewComponent.obj ..\source\uCEFViewDelegate.obj ..\source\uCEFViewsFrameworkEvents.obj ..\source\uCEFWaitableEvent.obj ..\source\uCEFWebPluginInfo.obj ..\source\uCEFWebPluginInfoVisitor.obj ..\source\uCEFWebPluginUnstableCallback.obj ..\source\uCEFWinControl.obj ..\source\uCEFWindow.obj ..\source\uCEFWindowComponent.obj ..\source\uCEFWindowDelegate.obj ..\source\uCEFWindowParent.obj ..\source\uCEFWorkScheduler.obj ..\source\uCEFWorkSchedulerQueueThread.obj ..\source\uCEFWorkSchedulerThread.obj ..\source\uCEFWriteHandler.obj ..\source\uCEFX509CertPrincipal.obj ..\source\uCEFX509Certificate.obj ..\source\uCEFXmlReader.obj ..\source\uCEFZipReader.obj ..\source\uCEFv8Accessor.obj ..\source\uCEFv8ArrayBufferReleaseCallback.obj ..\source\uCEFv8Context.obj ..\source\uCEFv8Exception.obj ..\source\uCEFv8Handler.obj ..\source\uCEFv8Interceptor.obj ..\source\uCEFv8StackFrame.obj ..\source\uCEFv8StackTrace.obj ..\source\uCEFv8Value.obj ..\packages\CEF4Delphi_Register.obj maxicef.obj, +
maxicef.bpl,, +
Rxctl5.lib import32.lib cp32mti.lib, +
, +
maxicef.res ..\packages\res\chromium.dcr
如您所见,c:\windows\system32;
包含在路径中。
所以,我假设从 32 位应用程序导入 64 位 DLL 有问题,整个互联网都说这是真的。
我开始使用 Wine
中的代码在一个单独的 C++ 模块中重新实现这些函数,但它确实是非常多的代码。突然我看到我们用 C++Builder 5 构建的另一个 32 位 DLL 实际上确实引用了 64 位 DLL!
那么,从使用 C++Builder 5 构建的库中的 System32
64 位 DLL 调用函数的技巧是什么?
更新:
这里有证据表明函数实际上是从父 DLL 导入的:
更新:
多一个证据:
更新
好的,这是生成文件:
# ---------------------------------------------------------------------------
!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.05.03
# ---------------------------------------------------------------------------
PROJECT = maxicef.bpl
OBJFILES = \
# ..\winlib\winlib.obj \
..\addons\MaxiSysUtils.obj \
..\source\uCEFAccessibilityHandler.obj \
..\source\uCEFApp.obj \
..\source\uCEFApplication.obj \
..\source\uCEFApplicationCore.obj \
..\source\uCEFAudioHandler.obj \
..\source\uCEFAuthCallback.obj \
..\source\uCEFBaseRefCounted.obj \
..\source\uCEFBaseScopedWrapper.obj \
..\source\uCEFBeforeDownloadCallback.obj \
..\source\uCEFBinaryValue.obj \
..\source\uCEFBitmapBitBuffer.obj \
..\source\uCEFBoxLayout.obj \
..\source\uCEFBrowser.obj \
..\source\uCEFBrowserProcessHandler.obj \
..\source\uCEFBrowserView.obj \
..\source\uCEFBrowserViewComponent.obj \
..\source\uCEFBrowserViewDelegate.obj \
..\source\uCEFBufferPanel.obj \
..\source\uCEFButton.obj \
..\source\uCEFButtonComponent.obj \
..\source\uCEFButtonDelegate.obj \
..\source\uCEFCallback.obj \
..\source\uCEFChromium.obj \
..\source\uCEFChromiumCore.obj \
..\source\uCEFChromiumEvents.obj \
..\source\uCEFChromiumFontOptions.obj \
..\source\uCEFChromiumOptions.obj \
..\source\uCEFChromiumWindow.obj \
..\source\uCEFClient.obj \
..\source\uCEFCommandLine.obj \
..\source\uCEFCompletionCallback.obj \
..\source\uCEFConstants.obj \
..\source\uCEFContextMenuHandler.obj \
..\source\uCEFContextMenuParams.obj \
..\source\uCEFCookieAccessFilter.obj \
..\source\uCEFCookieManager.obj \
..\source\uCEFCookieVisitor.obj \
..\source\uCEFCustomStreamReader.obj \
..\source\uCEFDeleteCookiesCallback.obj \
..\source\uCEFDevToolsMessageObserver.obj \
..\source\uCEFDialogHandler.obj \
..\source\uCEFDictionaryValue.obj \
..\source\uCEFDisplay.obj \
..\source\uCEFDisplayHandler.obj \
..\source\uCEFDomDocument.obj \
..\source\uCEFDomNode.obj \
..\source\uCEFDomVisitor.obj \
..\source\uCEFDownLoadItem.obj \
..\source\uCEFDownloadHandler.obj \
..\source\uCEFDownloadImageCallBack.obj \
..\source\uCEFDownloadItemCallback.obj \
..\source\uCEFDragAndDropMgr.obj \
..\source\uCEFDragData.obj \
..\source\uCEFDragHandler.obj \
..\source\uCEFEndTracingCallback.obj \
..\source\uCEFExtension.obj \
..\source\uCEFExtensionHandler.obj \
..\source\uCEFFileDialogCallback.obj \
..\source\uCEFFillLayout.obj \
..\source\uCEFFindHandler.obj \
..\source\uCEFFocusHandler.obj \
..\source\uCEFFrame.obj \
..\source\uCEFFrameHandler.obj \
..\source\uCEFGetExtensionResourceCallback.obj \
..\source\uCEFImage.obj \
..\source\uCEFInterfaces.obj \
..\source\uCEFJsDialogCallback.obj \
..\source\uCEFJsDialogHandler.obj \
..\source\uCEFJson.obj \
..\source\uCEFKeyboardHandler.obj \
..\source\uCEFLabelButton.obj \
..\source\uCEFLabelButtonComponent.obj \
..\source\uCEFLayout.obj \
..\source\uCEFLibFunctions.obj \
..\source\uCEFLifeSpanHandler.obj \
..\source\uCEFLinkedWinControlBase.obj \
..\source\uCEFLinkedWindowParent.obj \
..\source\uCEFListValue.obj \
..\source\uCEFLoadHandler.obj \
..\source\uCEFMediaObserver.obj \
..\source\uCEFMediaRoute.obj \
..\source\uCEFMediaRouteCreateCallback.obj \
..\source\uCEFMediaRouter.obj \
..\source\uCEFMediaSink.obj \
..\source\uCEFMediaSinkDeviceInfoCallback.obj \
..\source\uCEFMediaSource.obj \
..\source\uCEFMenuButton.obj \
..\source\uCEFMenuButtonComponent.obj \
..\source\uCEFMenuButtonDelegate.obj \
..\source\uCEFMenuButtonPressedLock.obj \
..\source\uCEFMenuModel.obj \
..\source\uCEFMenuModelDelegate.obj \
..\source\uCEFMiscFunctions.obj \
..\source\uCEFNavigationEntry.obj \
..\source\uCEFNavigationEntryVisitor.obj \
..\source\uCEFOAuth2Helper.obj \
..\source\uCEFOLEDragAndDrop.obj \
..\source\uCEFOSRIMEHandler.obj \
..\source\uCEFOverlayController.obj \
..\source\uCEFPDFPrintCallback.obj \
..\source\uCEFPDFPrintOptions.obj \
..\source\uCEFPanel.obj \
..\source\uCEFPanelComponent.obj \
..\source\uCEFPanelDelegate.obj \
..\source\uCEFPostData.obj \
..\source\uCEFPostDataElement.obj \
..\source\uCEFPrintDialogCallback.obj \
..\source\uCEFPrintHandler.obj \
..\source\uCEFPrintJobCallback.obj \
..\source\uCEFPrintSettings.obj \
..\source\uCEFProcessMessage.obj \
..\source\uCEFRegistration.obj \
..\source\uCEFRenderHandler.obj \
..\source\uCEFRenderProcessHandler.obj \
..\source\uCEFRequest.obj \
..\source\uCEFRequestContext.obj \
..\source\uCEFRequestContextHandler.obj \
..\source\uCEFRequestHandler.obj \
..\source\uCEFResolveCallback.obj \
..\source\uCEFResourceBundle.obj \
..\source\uCEFResourceBundleHandler.obj \
..\source\uCEFResourceHandler.obj \
..\source\uCEFResourceReadCallback.obj \
..\source\uCEFResourceRequestHandler.obj \
..\source\uCEFResourceSkipCallback.obj \
..\source\uCEFResponse.obj \
..\source\uCEFResponseFilter.obj \
..\source\uCEFRunContextMenuCallback.obj \
..\source\uCEFRunFileDialogCallback.obj \
..\source\uCEFSSLStatus.obj \
..\source\uCEFSchemeHandlerFactory.obj \
..\source\uCEFSchemeRegistrar.obj \
..\source\uCEFScrollView.obj \
..\source\uCEFScrollViewComponent.obj \
..\source\uCEFSelectClientCertificateCallback.obj \
..\source\uCEFSentinel.obj \
..\source\uCEFServer.obj \
..\source\uCEFServerComponent.obj \
..\source\uCEFServerEvents.obj \
..\source\uCEFServerHandler.obj \
..\source\uCEFSetCookieCallback.obj \
..\source\uCEFSslInfo.obj \
..\source\uCEFStreamReader.obj \
..\source\uCEFStreamWriter.obj \
..\source\uCEFStringList.obj \
..\source\uCEFStringMap.obj \
..\source\uCEFStringMultimap.obj \
..\source\uCEFStringVisitor.obj \
..\source\uCEFTask.obj \
..\source\uCEFTaskRunner.obj \
..\source\uCEFTextfield.obj \
..\source\uCEFTextfieldComponent.obj \
..\source\uCEFTextfieldDelegate.obj \
..\source\uCEFThread.obj \
..\source\uCEFTimerWorkScheduler.obj \
..\source\uCEFTypes.obj \
..\source\uCEFUrlRequest.obj \
..\source\uCEFUrlRequestClientComponent.obj \
..\source\uCEFUrlRequestClientEvents.obj \
..\source\uCEFUrlrequestClient.obj \
..\source\uCEFValue.obj \
..\source\uCEFView.obj \
..\source\uCEFViewComponent.obj \
..\source\uCEFViewDelegate.obj \
..\source\uCEFViewsFrameworkEvents.obj \
..\source\uCEFWaitableEvent.obj \
..\source\uCEFWebPluginInfo.obj \
..\source\uCEFWebPluginInfoVisitor.obj \
..\source\uCEFWebPluginUnstableCallback.obj \
..\source\uCEFWinControl.obj \
..\source\uCEFWindow.obj \
..\source\uCEFWindowComponent.obj \
..\source\uCEFWindowDelegate.obj \
..\source\uCEFWindowParent.obj \
..\source\uCEFWorkScheduler.obj \
..\source\uCEFWorkSchedulerQueueThread.obj \
..\source\uCEFWorkSchedulerThread.obj \
..\source\uCEFWriteHandler.obj \
..\source\uCEFX509CertPrincipal.obj \
..\source\uCEFX509Certificate.obj \
..\source\uCEFXmlReader.obj \
..\source\uCEFZipReader.obj \
..\source\uCEFv8Accessor.obj \
..\source\uCEFv8ArrayBufferReleaseCallback.obj \
..\source\uCEFv8Context.obj \
..\source\uCEFv8Exception.obj \
..\source\uCEFv8Handler.obj \
..\source\uCEFv8Interceptor.obj \
..\source\uCEFv8StackFrame.obj \
..\source\uCEFv8StackTrace.obj \
..\source\uCEFv8Value.obj \
..\packages\CEF4Delphi_Register.obj \
maxicef.obj
RESFILES = maxicef.res ..\packages\res\chromium.dcr
MAINSOURCE = maxicef.cpp
RESDEPEN = $(RESFILES)
LIBFILES =
IDLFILES =
IDLGENFILES =
LIBRARIES = Rxctl5.lib
PACKAGES = vcl50.bpi
SPARELIBS = Vcl50.lib Rxctl5.lib
DEFFILE =
# ---------------------------------------------------------------------------
PATHCPP = .;..\winlib;
PATHASM = .;
PATHPAS = .;..\source;..\packages;..\addons;
PATHRC = .;..\packages\res;
DEBUGLIBPATH = $(BCB)\lib\debug;
RELEASELIBPATH = $(BCB)\lib\release
USERDEFINES = _DEBUG;MSWINDOWS;CPUX32;TARGET_32BITS;VER130;
SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
INCLUDEPATH = ..\source;..\packages;..\addons;..\winlib;$(BCB)\include;$(BCB)\include\vcl
LIBPATH = ..\source;..\packages;..\packages\res;..\addons;..\winlib;c:\windows\system32;c:\windows\SysWOW64;L:\Lib;$(BCB)\lib\obj;$(BCB)\lib;
WARNINGS= -w-par
# ---------------------------------------------------------------------------
CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c -tWM -H=vcl50.csm
IDLCFLAGS = -I..\source -I..\packages -I..\addons -I..\winlib -I$(BCB)\include -I$(BCB)\include\vcl \
-src_suffix cpp -D_DEBUG -DMSWINDOWS -DCPUX32 -DTARGET_32BITS -DVER130 -boa
PFLAGS = -$YD -$W -$O- -v -JPHNE -M
RFLAGS =
AFLAGS = /mx /w2 /zd
LFLAGS = -D"" -aa -Tpp -x -Gn -Gl -Gi -v
# ---------------------------------------------------------------------------
ALLOBJ = c0pkg32.obj $(PACKAGES) Memmgr.Lib sysinit.obj $(OBJFILES)
ALLRES = $(RESFILES)
ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
# ---------------------------------------------------------------------------
!ifdef IDEOPTIONS
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
!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 "$(USERDEFINES)" != ""
AUSERDEFINES = -d$(USERDEFINES:;= -d)
!else
AUSERDEFINES =
!endif
!if !$d(BCC32)
BCC32 = bcc32ide
!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(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) -L$(LIBPATH) +
$(ALLOBJ), +
$(PROJECT),, +
$(ALLLIB), +
$(DEFFILE), +
$(ALLRES)
!
# ---------------------------------------------------------------------------
.pas.hpp:
$(BCB)\BIN$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }
.pas.obj:
$(BCB)\BIN$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }
.cpp.obj:
$(BCB)\BIN$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }
.c.obj:
$(BCB)\BIN$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }
.c.i:
$(BCB)\BIN$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }
.cpp.i:
$(BCB)\BIN$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }
.asm.obj:
$(BCB)\BIN$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@
.rc.res:
$(BCB)\BIN$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<
# ---------------------------------------------------------------------------
更新
对于@PaulMcKenzie:我有一个 64 位 OS,我需要在 64 位 OS 上使用 Borland C++Builder 5 构建一个 32 位应用程序到 运行。我遇到的问题是 Unresolved external
错误的问题,当我从我的 .pas
文件中引用驻留在 Windows DLL 中的 Windows 函数时。
好的,谢谢大家,让我明白了导入DLL的过程
正如 IInspectable
和 Remy Lebeau
所说 - DLL
的导入需要与 LIB
链接。 Here 是更多的解释。还有 google - “将共享库链接到可执行文件”。 .so
还是.dll
都不重要,原理都是一样的
在我给出解决方案之前还有一个重点。
正如Remy Lebeau
所说:几个函数
didn't exist yet (or were introduced shortly before) when BCB5 was released
解决方案
第一
修复生成文件
LIBRARIES = Rxctl5.lib shlwapi.lib kernel32.lib user32.lib
LIBPATH = ...;..\libs;
- 在
LIBRARIES
部分添加所有必需的 .lib
文件。
- 在
LIBPATH
部分的路径中添加一个新文件夹。
第二
尽管在您的 BCB
安装中存在具有 .lib
功能的文件夹:
您需要重新创建 .lib
文件。我在 T:\
虚拟驱动器上安装了 Borland C++ builder
:
> cd ..\libs
> T:\Bin\implib.exe kernel32.lib c:\Windows\SysWOW64\kernel32.dll
我将库放在相对于 makefile
的文件夹 ..\libs
中。
第三
Borland
的编译器中存在错误。它无法编译从 class 方法调用外部函数,因此您需要添加代理:
unit uCEFMiscFunctions;
interface
const
Kernel32DLL = 'kernel32.dll';
{$IFDEF MSWINDOWS}
function GetGlobalMemoryStatusEx_(lpBuffer: LPMEMORYSTATUSEX): BOOL;
function GetGlobalMemoryStatusEx(lpBuffer: LPMEMORYSTATUSEX): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
{$ENDIF}
implementation
{$IFDEF MSWINDOWS}
function GetGlobalMemoryStatusEx_(lpBuffer: LPMEMORYSTATUSEX): BOOL;
begin
Result := GetGlobalMemoryStatusEx(lpBuffer);
end;
{$ENDIF}
unit uCEFApplicationCore;
...
function TCefApplicationCore.GetTotalSystemMemory : UInt64;
{$IFDEF MSWINDOWS}
var
TempMemStatus : TMyMemoryStatusEx;
{$ENDIF}
begin
Result := 0;
{$IFDEF MSWINDOWS}
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
if GetGlobalMemoryStatusEx_(@TempMemStatus) then
if True then
Result := TempMemStatus.ullTotalPhys;
{$ENDIF}
end;
我正在将 CEF4Delfi 库移植到 Borland C++Builder 5。我从移植的 CEF4Delfi 源代码制作了一个 BPL 包,并从我的 C++Builder 5 代码中引用它。
我在 Windows 10 64 位上工作。
在移植时,我卡在了导入 DLL 函数上。
这是导入的一部分:
const
Kernel32DLL = 'kernel32.dll';
SHLWAPIDLL = 'shlwapi.dll';
NTDLL = 'ntdll.dll';
User32DLL = 'User32.dll';
function ProcessUnderWow64(hProcess: THandle; Wow64Process: PBOOL): BOOL; stdcall; external Kernel32DLL name 'IsWow64Process';
function PathIsRelativeAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeA';
function PathIsRelativeUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeW';
function GetGlobalMemoryStatusEx(lpBuffer: LPMEMORYSTATUSEX): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
function PathCanonicalizeAnsi(pszBuf: LPSTR; pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeA';
function PathCanonicalizeUnicode(pszBuf: LPWSTR; pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeW';
function PathIsUNCAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCA';
function PathIsUNCUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsUNCW';
function PathIsURLAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLA';
function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW';
function ShutdownBlockReasonCreate(hWnd: HWND; Reason: LPCWSTR): Bool; stdcall; external User32DLL;
function ShutdownBlockReasonDestroy(hWnd: HWND): Bool; stdcall; external User32DLL;
由于链接,我收到如下错误:
Error: Unresolved external 'PathIsRelativeA' referenced from C:\REPOS\CEF4DELPHI\SOURCE\UCEFMISCFUNCTIONS.OBJ
Error: Unresolved external 'AlphaBlend' referenced from C:\REPOS\CEF4DELPHI\SOURCE\UCEFBUFFERPANEL.OBJ
Error: Unresolved external 'IsWow64Process' referenced from C:\REPOS\CEF4DELPHI\SOURCE\UCEFMISCFUNCTIONS.OBJ
这是来自 C++Builder 的临时 MAKE0000.@@@
链接文件:
-D"" -aa -Tpp -x -Gn -Gl -Gi -v -L..\source;..\packages;..\packages\res;..\addons;..\winlib;c:\windows\system32;L:\Lib;T:\bin\..\lib\obj;T:\bin\..\lib; +
c0pkg32.obj vcl50.bpi Memmgr.Lib sysinit.obj ..\addons\MaxiSysUtils.obj ..\source\uCEFAccessibilityHandler.obj ..\source\uCEFApp.obj ..\source\uCEFApplication.obj ..\source\uCEFApplicationCore.obj ..\source\uCEFAudioHandler.obj ..\source\uCEFAuthCallback.obj ..\source\uCEFBaseRefCounted.obj ..\source\uCEFBaseScopedWrapper.obj ..\source\uCEFBeforeDownloadCallback.obj ..\source\uCEFBinaryValue.obj ..\source\uCEFBitmapBitBuffer.obj ..\source\uCEFBoxLayout.obj ..\source\uCEFBrowser.obj ..\source\uCEFBrowserProcessHandler.obj ..\source\uCEFBrowserView.obj ..\source\uCEFBrowserViewComponent.obj ..\source\uCEFBrowserViewDelegate.obj ..\source\uCEFBufferPanel.obj ..\source\uCEFButton.obj ..\source\uCEFButtonComponent.obj ..\source\uCEFButtonDelegate.obj ..\source\uCEFCallback.obj ..\source\uCEFChromium.obj ..\source\uCEFChromiumCore.obj ..\source\uCEFChromiumEvents.obj ..\source\uCEFChromiumFontOptions.obj ..\source\uCEFChromiumOptions.obj ..\source\uCEFChromiumWindow.obj ..\source\uCEFClient.obj ..\source\uCEFCommandLine.obj ..\source\uCEFCompletionCallback.obj ..\source\uCEFConstants.obj ..\source\uCEFContextMenuHandler.obj ..\source\uCEFContextMenuParams.obj ..\source\uCEFCookieAccessFilter.obj ..\source\uCEFCookieManager.obj ..\source\uCEFCookieVisitor.obj ..\source\uCEFCustomStreamReader.obj ..\source\uCEFDeleteCookiesCallback.obj ..\source\uCEFDevToolsMessageObserver.obj ..\source\uCEFDialogHandler.obj ..\source\uCEFDictionaryValue.obj ..\source\uCEFDisplay.obj ..\source\uCEFDisplayHandler.obj ..\source\uCEFDomDocument.obj ..\source\uCEFDomNode.obj ..\source\uCEFDomVisitor.obj ..\source\uCEFDownLoadItem.obj ..\source\uCEFDownloadHandler.obj ..\source\uCEFDownloadImageCallBack.obj ..\source\uCEFDownloadItemCallback.obj ..\source\uCEFDragAndDropMgr.obj ..\source\uCEFDragData.obj ..\source\uCEFDragHandler.obj ..\source\uCEFEndTracingCallback.obj ..\source\uCEFExtension.obj ..\source\uCEFExtensionHandler.obj ..\source\uCEFFileDialogCallback.obj ..\source\uCEFFillLayout.obj ..\source\uCEFFindHandler.obj ..\source\uCEFFocusHandler.obj ..\source\uCEFFrame.obj ..\source\uCEFFrameHandler.obj ..\source\uCEFGetExtensionResourceCallback.obj ..\source\uCEFImage.obj ..\source\uCEFInterfaces.obj ..\source\uCEFJsDialogCallback.obj ..\source\uCEFJsDialogHandler.obj ..\source\uCEFJson.obj ..\source\uCEFKeyboardHandler.obj ..\source\uCEFLabelButton.obj ..\source\uCEFLabelButtonComponent.obj ..\source\uCEFLayout.obj ..\source\uCEFLibFunctions.obj ..\source\uCEFLifeSpanHandler.obj ..\source\uCEFLinkedWinControlBase.obj ..\source\uCEFLinkedWindowParent.obj ..\source\uCEFListValue.obj ..\source\uCEFLoadHandler.obj ..\source\uCEFMediaObserver.obj ..\source\uCEFMediaRoute.obj ..\source\uCEFMediaRouteCreateCallback.obj ..\source\uCEFMediaRouter.obj ..\source\uCEFMediaSink.obj ..\source\uCEFMediaSinkDeviceInfoCallback.obj ..\source\uCEFMediaSource.obj ..\source\uCEFMenuButton.obj ..\source\uCEFMenuButtonComponent.obj ..\source\uCEFMenuButtonDelegate.obj ..\source\uCEFMenuButtonPressedLock.obj ..\source\uCEFMenuModel.obj ..\source\uCEFMenuModelDelegate.obj ..\source\uCEFMiscFunctions.obj ..\source\uCEFNavigationEntry.obj ..\source\uCEFNavigationEntryVisitor.obj ..\source\uCEFOAuth2Helper.obj ..\source\uCEFOLEDragAndDrop.obj ..\source\uCEFOSRIMEHandler.obj ..\source\uCEFOverlayController.obj ..\source\uCEFPDFPrintCallback.obj ..\source\uCEFPDFPrintOptions.obj ..\source\uCEFPanel.obj ..\source\uCEFPanelComponent.obj ..\source\uCEFPanelDelegate.obj ..\source\uCEFPostData.obj ..\source\uCEFPostDataElement.obj ..\source\uCEFPrintDialogCallback.obj ..\source\uCEFPrintHandler.obj ..\source\uCEFPrintJobCallback.obj ..\source\uCEFPrintSettings.obj ..\source\uCEFProcessMessage.obj ..\source\uCEFRegistration.obj ..\source\uCEFRenderHandler.obj ..\source\uCEFRenderProcessHandler.obj ..\source\uCEFRequest.obj ..\source\uCEFRequestContext.obj ..\source\uCEFRequestContextHandler.obj ..\source\uCEFRequestHandler.obj ..\source\uCEFResolveCallback.obj ..\source\uCEFResourceBundle.obj ..\source\uCEFResourceBundleHandler.obj ..\source\uCEFResourceHandler.obj ..\source\uCEFResourceReadCallback.obj ..\source\uCEFResourceRequestHandler.obj ..\source\uCEFResourceSkipCallback.obj ..\source\uCEFResponse.obj ..\source\uCEFResponseFilter.obj ..\source\uCEFRunContextMenuCallback.obj ..\source\uCEFRunFileDialogCallback.obj ..\source\uCEFSSLStatus.obj ..\source\uCEFSchemeHandlerFactory.obj ..\source\uCEFSchemeRegistrar.obj ..\source\uCEFScrollView.obj ..\source\uCEFScrollViewComponent.obj ..\source\uCEFSelectClientCertificateCallback.obj ..\source\uCEFSentinel.obj ..\source\uCEFServer.obj ..\source\uCEFServerComponent.obj ..\source\uCEFServerEvents.obj ..\source\uCEFServerHandler.obj ..\source\uCEFSetCookieCallback.obj ..\source\uCEFSslInfo.obj ..\source\uCEFStreamReader.obj ..\source\uCEFStreamWriter.obj ..\source\uCEFStringList.obj ..\source\uCEFStringMap.obj ..\source\uCEFStringMultimap.obj ..\source\uCEFStringVisitor.obj ..\source\uCEFTask.obj ..\source\uCEFTaskRunner.obj ..\source\uCEFTextfield.obj ..\source\uCEFTextfieldComponent.obj ..\source\uCEFTextfieldDelegate.obj ..\source\uCEFThread.obj ..\source\uCEFTimerWorkScheduler.obj ..\source\uCEFTypes.obj ..\source\uCEFUrlRequest.obj ..\source\uCEFUrlRequestClientComponent.obj ..\source\uCEFUrlRequestClientEvents.obj ..\source\uCEFUrlrequestClient.obj ..\source\uCEFValue.obj ..\source\uCEFView.obj ..\source\uCEFViewComponent.obj ..\source\uCEFViewDelegate.obj ..\source\uCEFViewsFrameworkEvents.obj ..\source\uCEFWaitableEvent.obj ..\source\uCEFWebPluginInfo.obj ..\source\uCEFWebPluginInfoVisitor.obj ..\source\uCEFWebPluginUnstableCallback.obj ..\source\uCEFWinControl.obj ..\source\uCEFWindow.obj ..\source\uCEFWindowComponent.obj ..\source\uCEFWindowDelegate.obj ..\source\uCEFWindowParent.obj ..\source\uCEFWorkScheduler.obj ..\source\uCEFWorkSchedulerQueueThread.obj ..\source\uCEFWorkSchedulerThread.obj ..\source\uCEFWriteHandler.obj ..\source\uCEFX509CertPrincipal.obj ..\source\uCEFX509Certificate.obj ..\source\uCEFXmlReader.obj ..\source\uCEFZipReader.obj ..\source\uCEFv8Accessor.obj ..\source\uCEFv8ArrayBufferReleaseCallback.obj ..\source\uCEFv8Context.obj ..\source\uCEFv8Exception.obj ..\source\uCEFv8Handler.obj ..\source\uCEFv8Interceptor.obj ..\source\uCEFv8StackFrame.obj ..\source\uCEFv8StackTrace.obj ..\source\uCEFv8Value.obj ..\packages\CEF4Delphi_Register.obj maxicef.obj, +
maxicef.bpl,, +
Rxctl5.lib import32.lib cp32mti.lib, +
, +
maxicef.res ..\packages\res\chromium.dcr
如您所见,c:\windows\system32;
包含在路径中。
所以,我假设从 32 位应用程序导入 64 位 DLL 有问题,整个互联网都说这是真的。
我开始使用 Wine
中的代码在一个单独的 C++ 模块中重新实现这些函数,但它确实是非常多的代码。突然我看到我们用 C++Builder 5 构建的另一个 32 位 DLL 实际上确实引用了 64 位 DLL!
那么,从使用 C++Builder 5 构建的库中的 System32
64 位 DLL 调用函数的技巧是什么?
更新:
这里有证据表明函数实际上是从父 DLL 导入的:
更新:
多一个证据:
更新
好的,这是生成文件:
# ---------------------------------------------------------------------------
!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.05.03
# ---------------------------------------------------------------------------
PROJECT = maxicef.bpl
OBJFILES = \
# ..\winlib\winlib.obj \
..\addons\MaxiSysUtils.obj \
..\source\uCEFAccessibilityHandler.obj \
..\source\uCEFApp.obj \
..\source\uCEFApplication.obj \
..\source\uCEFApplicationCore.obj \
..\source\uCEFAudioHandler.obj \
..\source\uCEFAuthCallback.obj \
..\source\uCEFBaseRefCounted.obj \
..\source\uCEFBaseScopedWrapper.obj \
..\source\uCEFBeforeDownloadCallback.obj \
..\source\uCEFBinaryValue.obj \
..\source\uCEFBitmapBitBuffer.obj \
..\source\uCEFBoxLayout.obj \
..\source\uCEFBrowser.obj \
..\source\uCEFBrowserProcessHandler.obj \
..\source\uCEFBrowserView.obj \
..\source\uCEFBrowserViewComponent.obj \
..\source\uCEFBrowserViewDelegate.obj \
..\source\uCEFBufferPanel.obj \
..\source\uCEFButton.obj \
..\source\uCEFButtonComponent.obj \
..\source\uCEFButtonDelegate.obj \
..\source\uCEFCallback.obj \
..\source\uCEFChromium.obj \
..\source\uCEFChromiumCore.obj \
..\source\uCEFChromiumEvents.obj \
..\source\uCEFChromiumFontOptions.obj \
..\source\uCEFChromiumOptions.obj \
..\source\uCEFChromiumWindow.obj \
..\source\uCEFClient.obj \
..\source\uCEFCommandLine.obj \
..\source\uCEFCompletionCallback.obj \
..\source\uCEFConstants.obj \
..\source\uCEFContextMenuHandler.obj \
..\source\uCEFContextMenuParams.obj \
..\source\uCEFCookieAccessFilter.obj \
..\source\uCEFCookieManager.obj \
..\source\uCEFCookieVisitor.obj \
..\source\uCEFCustomStreamReader.obj \
..\source\uCEFDeleteCookiesCallback.obj \
..\source\uCEFDevToolsMessageObserver.obj \
..\source\uCEFDialogHandler.obj \
..\source\uCEFDictionaryValue.obj \
..\source\uCEFDisplay.obj \
..\source\uCEFDisplayHandler.obj \
..\source\uCEFDomDocument.obj \
..\source\uCEFDomNode.obj \
..\source\uCEFDomVisitor.obj \
..\source\uCEFDownLoadItem.obj \
..\source\uCEFDownloadHandler.obj \
..\source\uCEFDownloadImageCallBack.obj \
..\source\uCEFDownloadItemCallback.obj \
..\source\uCEFDragAndDropMgr.obj \
..\source\uCEFDragData.obj \
..\source\uCEFDragHandler.obj \
..\source\uCEFEndTracingCallback.obj \
..\source\uCEFExtension.obj \
..\source\uCEFExtensionHandler.obj \
..\source\uCEFFileDialogCallback.obj \
..\source\uCEFFillLayout.obj \
..\source\uCEFFindHandler.obj \
..\source\uCEFFocusHandler.obj \
..\source\uCEFFrame.obj \
..\source\uCEFFrameHandler.obj \
..\source\uCEFGetExtensionResourceCallback.obj \
..\source\uCEFImage.obj \
..\source\uCEFInterfaces.obj \
..\source\uCEFJsDialogCallback.obj \
..\source\uCEFJsDialogHandler.obj \
..\source\uCEFJson.obj \
..\source\uCEFKeyboardHandler.obj \
..\source\uCEFLabelButton.obj \
..\source\uCEFLabelButtonComponent.obj \
..\source\uCEFLayout.obj \
..\source\uCEFLibFunctions.obj \
..\source\uCEFLifeSpanHandler.obj \
..\source\uCEFLinkedWinControlBase.obj \
..\source\uCEFLinkedWindowParent.obj \
..\source\uCEFListValue.obj \
..\source\uCEFLoadHandler.obj \
..\source\uCEFMediaObserver.obj \
..\source\uCEFMediaRoute.obj \
..\source\uCEFMediaRouteCreateCallback.obj \
..\source\uCEFMediaRouter.obj \
..\source\uCEFMediaSink.obj \
..\source\uCEFMediaSinkDeviceInfoCallback.obj \
..\source\uCEFMediaSource.obj \
..\source\uCEFMenuButton.obj \
..\source\uCEFMenuButtonComponent.obj \
..\source\uCEFMenuButtonDelegate.obj \
..\source\uCEFMenuButtonPressedLock.obj \
..\source\uCEFMenuModel.obj \
..\source\uCEFMenuModelDelegate.obj \
..\source\uCEFMiscFunctions.obj \
..\source\uCEFNavigationEntry.obj \
..\source\uCEFNavigationEntryVisitor.obj \
..\source\uCEFOAuth2Helper.obj \
..\source\uCEFOLEDragAndDrop.obj \
..\source\uCEFOSRIMEHandler.obj \
..\source\uCEFOverlayController.obj \
..\source\uCEFPDFPrintCallback.obj \
..\source\uCEFPDFPrintOptions.obj \
..\source\uCEFPanel.obj \
..\source\uCEFPanelComponent.obj \
..\source\uCEFPanelDelegate.obj \
..\source\uCEFPostData.obj \
..\source\uCEFPostDataElement.obj \
..\source\uCEFPrintDialogCallback.obj \
..\source\uCEFPrintHandler.obj \
..\source\uCEFPrintJobCallback.obj \
..\source\uCEFPrintSettings.obj \
..\source\uCEFProcessMessage.obj \
..\source\uCEFRegistration.obj \
..\source\uCEFRenderHandler.obj \
..\source\uCEFRenderProcessHandler.obj \
..\source\uCEFRequest.obj \
..\source\uCEFRequestContext.obj \
..\source\uCEFRequestContextHandler.obj \
..\source\uCEFRequestHandler.obj \
..\source\uCEFResolveCallback.obj \
..\source\uCEFResourceBundle.obj \
..\source\uCEFResourceBundleHandler.obj \
..\source\uCEFResourceHandler.obj \
..\source\uCEFResourceReadCallback.obj \
..\source\uCEFResourceRequestHandler.obj \
..\source\uCEFResourceSkipCallback.obj \
..\source\uCEFResponse.obj \
..\source\uCEFResponseFilter.obj \
..\source\uCEFRunContextMenuCallback.obj \
..\source\uCEFRunFileDialogCallback.obj \
..\source\uCEFSSLStatus.obj \
..\source\uCEFSchemeHandlerFactory.obj \
..\source\uCEFSchemeRegistrar.obj \
..\source\uCEFScrollView.obj \
..\source\uCEFScrollViewComponent.obj \
..\source\uCEFSelectClientCertificateCallback.obj \
..\source\uCEFSentinel.obj \
..\source\uCEFServer.obj \
..\source\uCEFServerComponent.obj \
..\source\uCEFServerEvents.obj \
..\source\uCEFServerHandler.obj \
..\source\uCEFSetCookieCallback.obj \
..\source\uCEFSslInfo.obj \
..\source\uCEFStreamReader.obj \
..\source\uCEFStreamWriter.obj \
..\source\uCEFStringList.obj \
..\source\uCEFStringMap.obj \
..\source\uCEFStringMultimap.obj \
..\source\uCEFStringVisitor.obj \
..\source\uCEFTask.obj \
..\source\uCEFTaskRunner.obj \
..\source\uCEFTextfield.obj \
..\source\uCEFTextfieldComponent.obj \
..\source\uCEFTextfieldDelegate.obj \
..\source\uCEFThread.obj \
..\source\uCEFTimerWorkScheduler.obj \
..\source\uCEFTypes.obj \
..\source\uCEFUrlRequest.obj \
..\source\uCEFUrlRequestClientComponent.obj \
..\source\uCEFUrlRequestClientEvents.obj \
..\source\uCEFUrlrequestClient.obj \
..\source\uCEFValue.obj \
..\source\uCEFView.obj \
..\source\uCEFViewComponent.obj \
..\source\uCEFViewDelegate.obj \
..\source\uCEFViewsFrameworkEvents.obj \
..\source\uCEFWaitableEvent.obj \
..\source\uCEFWebPluginInfo.obj \
..\source\uCEFWebPluginInfoVisitor.obj \
..\source\uCEFWebPluginUnstableCallback.obj \
..\source\uCEFWinControl.obj \
..\source\uCEFWindow.obj \
..\source\uCEFWindowComponent.obj \
..\source\uCEFWindowDelegate.obj \
..\source\uCEFWindowParent.obj \
..\source\uCEFWorkScheduler.obj \
..\source\uCEFWorkSchedulerQueueThread.obj \
..\source\uCEFWorkSchedulerThread.obj \
..\source\uCEFWriteHandler.obj \
..\source\uCEFX509CertPrincipal.obj \
..\source\uCEFX509Certificate.obj \
..\source\uCEFXmlReader.obj \
..\source\uCEFZipReader.obj \
..\source\uCEFv8Accessor.obj \
..\source\uCEFv8ArrayBufferReleaseCallback.obj \
..\source\uCEFv8Context.obj \
..\source\uCEFv8Exception.obj \
..\source\uCEFv8Handler.obj \
..\source\uCEFv8Interceptor.obj \
..\source\uCEFv8StackFrame.obj \
..\source\uCEFv8StackTrace.obj \
..\source\uCEFv8Value.obj \
..\packages\CEF4Delphi_Register.obj \
maxicef.obj
RESFILES = maxicef.res ..\packages\res\chromium.dcr
MAINSOURCE = maxicef.cpp
RESDEPEN = $(RESFILES)
LIBFILES =
IDLFILES =
IDLGENFILES =
LIBRARIES = Rxctl5.lib
PACKAGES = vcl50.bpi
SPARELIBS = Vcl50.lib Rxctl5.lib
DEFFILE =
# ---------------------------------------------------------------------------
PATHCPP = .;..\winlib;
PATHASM = .;
PATHPAS = .;..\source;..\packages;..\addons;
PATHRC = .;..\packages\res;
DEBUGLIBPATH = $(BCB)\lib\debug;
RELEASELIBPATH = $(BCB)\lib\release
USERDEFINES = _DEBUG;MSWINDOWS;CPUX32;TARGET_32BITS;VER130;
SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
INCLUDEPATH = ..\source;..\packages;..\addons;..\winlib;$(BCB)\include;$(BCB)\include\vcl
LIBPATH = ..\source;..\packages;..\packages\res;..\addons;..\winlib;c:\windows\system32;c:\windows\SysWOW64;L:\Lib;$(BCB)\lib\obj;$(BCB)\lib;
WARNINGS= -w-par
# ---------------------------------------------------------------------------
CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c -tWM -H=vcl50.csm
IDLCFLAGS = -I..\source -I..\packages -I..\addons -I..\winlib -I$(BCB)\include -I$(BCB)\include\vcl \
-src_suffix cpp -D_DEBUG -DMSWINDOWS -DCPUX32 -DTARGET_32BITS -DVER130 -boa
PFLAGS = -$YD -$W -$O- -v -JPHNE -M
RFLAGS =
AFLAGS = /mx /w2 /zd
LFLAGS = -D"" -aa -Tpp -x -Gn -Gl -Gi -v
# ---------------------------------------------------------------------------
ALLOBJ = c0pkg32.obj $(PACKAGES) Memmgr.Lib sysinit.obj $(OBJFILES)
ALLRES = $(RESFILES)
ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
# ---------------------------------------------------------------------------
!ifdef IDEOPTIONS
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
!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 "$(USERDEFINES)" != ""
AUSERDEFINES = -d$(USERDEFINES:;= -d)
!else
AUSERDEFINES =
!endif
!if !$d(BCC32)
BCC32 = bcc32ide
!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(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) -L$(LIBPATH) +
$(ALLOBJ), +
$(PROJECT),, +
$(ALLLIB), +
$(DEFFILE), +
$(ALLRES)
!
# ---------------------------------------------------------------------------
.pas.hpp:
$(BCB)\BIN$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }
.pas.obj:
$(BCB)\BIN$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }
.cpp.obj:
$(BCB)\BIN$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }
.c.obj:
$(BCB)\BIN$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }
.c.i:
$(BCB)\BIN$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }
.cpp.i:
$(BCB)\BIN$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }
.asm.obj:
$(BCB)\BIN$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@
.rc.res:
$(BCB)\BIN$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<
# ---------------------------------------------------------------------------
更新
对于@PaulMcKenzie:我有一个 64 位 OS,我需要在 64 位 OS 上使用 Borland C++Builder 5 构建一个 32 位应用程序到 运行。我遇到的问题是 Unresolved external
错误的问题,当我从我的 .pas
文件中引用驻留在 Windows DLL 中的 Windows 函数时。
好的,谢谢大家,让我明白了导入DLL的过程
正如 IInspectable
和 Remy Lebeau
所说 - DLL
的导入需要与 LIB
链接。 Here 是更多的解释。还有 google - “将共享库链接到可执行文件”。 .so
还是.dll
都不重要,原理都是一样的
在我给出解决方案之前还有一个重点。
正如Remy Lebeau
所说:几个函数
didn't exist yet (or were introduced shortly before) when BCB5 was released
解决方案
第一
修复生成文件
LIBRARIES = Rxctl5.lib shlwapi.lib kernel32.lib user32.lib
LIBPATH = ...;..\libs;
- 在
LIBRARIES
部分添加所有必需的.lib
文件。 - 在
LIBPATH
部分的路径中添加一个新文件夹。
第二
尽管在您的 BCB
安装中存在具有 .lib
功能的文件夹:
您需要重新创建 .lib
文件。我在 T:\
虚拟驱动器上安装了 Borland C++ builder
:
> cd ..\libs
> T:\Bin\implib.exe kernel32.lib c:\Windows\SysWOW64\kernel32.dll
我将库放在相对于 makefile
的文件夹 ..\libs
中。
第三
Borland
的编译器中存在错误。它无法编译从 class 方法调用外部函数,因此您需要添加代理:
unit uCEFMiscFunctions;
interface
const
Kernel32DLL = 'kernel32.dll';
{$IFDEF MSWINDOWS}
function GetGlobalMemoryStatusEx_(lpBuffer: LPMEMORYSTATUSEX): BOOL;
function GetGlobalMemoryStatusEx(lpBuffer: LPMEMORYSTATUSEX): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
{$ENDIF}
implementation
{$IFDEF MSWINDOWS}
function GetGlobalMemoryStatusEx_(lpBuffer: LPMEMORYSTATUSEX): BOOL;
begin
Result := GetGlobalMemoryStatusEx(lpBuffer);
end;
{$ENDIF}
unit uCEFApplicationCore;
...
function TCefApplicationCore.GetTotalSystemMemory : UInt64;
{$IFDEF MSWINDOWS}
var
TempMemStatus : TMyMemoryStatusEx;
{$ENDIF}
begin
Result := 0;
{$IFDEF MSWINDOWS}
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
if GetGlobalMemoryStatusEx_(@TempMemStatus) then
if True then
Result := TempMemStatus.ullTotalPhys;
{$ENDIF}
end;