DllExport version
1.8.1
Known working version or edition
No response
Environment
(other)
Environment version
MS Office 365 64 bit VBA
What happened or what did you expect to happen?
While testing DLLs in VBA projects with different architectures, I noticed something that I think is a bug.
Try loading DLLs (x86+x64) compiled with DllExport into memory using the Kernel32 / LoadLibrary method.
An x86 DLL (32-bit VBA) will return a non-null Library Handle, and your method will work.
However, an x64 DLL (64-bit VBA) always returns a null Library Handle.
Here are the VBA codes (64 bit declaration):
Private Declare PtrSafe Function LoadLibraryA Lib "kernel32.dll" (ByVal dllName As String) As LongPtr
Sub Test()
' will return '0'
Debug.Print LoadLibraryA("SomeFolder\net9.0\x64\ClassLibrary1.dll")
End Sub
DllExport configuration
Installed: True; 1.8.1.36569+c2d3cd1; invoked:
Project type: Cs
Storage: ProjectFiles
Compiler.Platform: x86x64
Compiler.imageBase:
Compiler.imageBaseStep:
Compiler.ordinalsBase: 1
Compiler.rSysObj: True
Compiler.ourILAsm: True
Compiler.customILAsm:
Compiler.genExpLib: False
Compiler.peCheck: PeIl, Pe32orPlus
Compiler.patches: None
Compiler.refreshObj: False
PreProc.Type: DebugInfo, IgnoreErr, ILRepack, MergeRefPkg, Lib
PreProc.Cmd:
PostProc.Type: None
PostProc.ProcEnv: $(SolutionPath);$(MSBuildThisFileFullPath)
PostProc.Cmd:
AssemblyExternDirectives:
TypeRefDirectives:
TypeRefOptions: None
RefPackages: System.Memory,4.6.0,netstandard2.0;System.Runtime.CompilerServices.Unsafe,6.1.0,netstandard2.0;
SignAssembly(Debug):
PlatformTarget(Debug): AnyCPU
TargetFramework(Debug): net9.0
TargetFrameworks(Debug):
TargetFrameworkVersion(Debug):
TargetFrameworkIdentifier(Debug):
RootNamespace(Debug):
AssemblyName(Debug):
DebugType(Debug):
Optimize(Debug):
DebugSymbols(Debug):
SignAssembly(Release):
PlatformTarget(Release): AnyCPU
TargetFramework(Release): net9.0
TargetFrameworks(Release):
TargetFrameworkVersion(Release):
TargetFrameworkIdentifier(Release):
RootNamespace(Release):
AssemblyName(Release):
DebugType(Release):
Optimize(Release):
DebugSymbols(Release):
Identifier: A2DA65F9-2763-48E5-B292-A019EC72F8B8
Instance: C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe
Project path: C:\Users\zeki\Desktop\ClassLibrary2\ClassLibrary2\ClassLibrary2.csproj
Action: Configure
MgrArgs: -packages "C:\Users\zeki\Desktop\ClassLibrary2\" -sln-dir "C:\Users\zeki\Desktop\ClassLibrary2\" -dxp-version actual -action Configure
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy:
StoragePath: .net.dllexport.targets
ddNS: ClassLibrary2
ddNS max buffer: 500
UseCecil: False
intermediateFiles: False
timeout: 30000
Options: None
RootPath: C:\Users\zeki\Desktop\ClassLibrary2\DllExport\
PkgPath: C:\Users\zeki\Desktop\ClassLibrary2\\\DllExport\
SlnFile:
SlnDir: C:\Users\zeki\Desktop\ClassLibrary2\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgLevel: Debug
LockIfError:
Attach relevant logs if applicable
No response
Code of Conduct
DllExport version
1.8.1
Known working version or edition
No response
Environment
(other)
Environment version
MS Office 365 64 bit VBA
What happened or what did you expect to happen?
While testing DLLs in VBA projects with different architectures, I noticed something that I think is a bug.
Try loading DLLs (x86+x64) compiled with DllExport into memory using the Kernel32 / LoadLibrary method.
An x86 DLL (32-bit VBA) will return a non-null Library Handle, and your method will work.
However, an x64 DLL (64-bit VBA) always returns a null Library Handle.
Here are the VBA codes (64 bit declaration):
DllExport configuration
Attach relevant logs if applicable
No response
Code of Conduct