Skip to content

Commit add8a57

Browse files
authored
only remove ctor/dtor from cocos dlls
1 parent e748f4a commit add8a57

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/dll2lib.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030
exports_raw = subprocess.run(["dumpbin", "/exports", DLL_FILE], capture_output=True).stdout.decode()
3131
exports = [l.split()[3] for l in exports_raw.splitlines()[19:] if len(l.split()) > 3]
3232

33-
# Removes constructors and destructors
34-
for e in exports:
35-
if e.startswith('??0') or e.startswith('??1'):
36-
print(f"Removing {e}")
37-
exports = [e for e in exports if not e.startswith('??0') and not e.startswith('??1')]
33+
if DLL_NAME in ('libcocos2d', 'libExtensions'):
34+
# Removes constructors and destructors
35+
should_remove = lambda e: e.startswith('??0') or e.startswith('??1')
36+
for e in exports:
37+
if should_remove(e)
38+
print(f"Removing {e}")
39+
exports = [e for e in exports if not should_remove(e)]
3840

3941
with open(DEF_FILE, 'w') as file:
4042
file.write(f"LIBRARY {DLL_NAME}.dll\n")
@@ -44,4 +46,4 @@
4446
subprocess.run(["lib", f"/def:{DEF_FILE}", f"/out:{LIB_FILE}", f"/machine:{machine}"])
4547

4648
os.remove(DEF_FILE)
47-
os.remove(f"{DLL_NAME}.exp")
49+
os.remove(f"{DLL_NAME}.exp")

0 commit comments

Comments
 (0)