Godot Version
4.3
Question
Does anyone know how to bind an external library that only has a dll and source files and no .lib or .a. Its the Bandicam SDK and its a runtime only dll.
Im getting unresolved external symbols if I dont Append the dll and I get cannot open LNK1181 cannot open input file ‘bdvid64.windows.editor.dev.x86_64.lib’ if I do append the dll to the LIBS path. If I append it to LIBS with File(‘bdvid64.dll’) I get invalid or corrupt file. Ive already confirmed that it works on a separate project with the same setup so it has to be the SCsub.
Here is my SCsub:
#SCsub
Import(“env”)
Import(“env_modules”)
env_bvl = env.Clone()
env_bvl.add_source_files(env.modules_sources, “*.cpp”)
env_bvl.Append(CPPPATH=[“source”, “include”])
env.Append(LIBPATH=[‘lib’])
env.Append(LIBS=[‘bdvid64’])
env.Command(
‘#bin/bdvid64.dll’, # Replace with your desired output DLL name
‘lib/bdvid64.dll’, # Path to the DLL
‘copy $SOURCE $TARGET’ # Change to ‘cp’ if on Unix-based systems
)
If anyone runs into the same issue of needing to add an external library that has only the dll and header and source files heres how I did it in my SCsub:
#SCsub
Import("env")
Import("env_modules")
env_bvl = env_modules.Clone()
thirdparty_obj = []
if env["builtin_libbvl"]:
thirdparty_dir = "#thirdparty/libbvl/source/"
thirdparty_sources = [
"BandiVideoSound_NULL.cpp",
"BandiVideoSound_DS.cpp",
"BandiVideoLibrary.cpp",
"BandiVideoFileReader.cpp",
"BandiVideoTexture_DX9.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_thirdparty = env_bvl.Clone()
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
env.modules_sources += thirdparty_obj
# Godot source files
module_obj = []
env_bvl.add_source_files(module_obj, "*.cpp")
env.modules_sources += module_obj
# Needed to force rebuilding the module files when the thirdparty library is updated.
env.Depends(module_obj, thirdparty_obj)
I do still have one issue where, Im getting unresolved external symbols for d3d9.h even though I have it in my include and library directories. I will update the post with the solution if I figure it out.