================
@@ -0,0 +1,17 @@
+import os
+
+from clang.cindex import Config, conf, FUNCTION_LIST
+
+if "CLANG_LIBRARY_PATH" in os.environ:
+    Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
+
+import unittest
+
+
+class TestIndex(unittest.TestCase):
+    def test_functions_registered(self):
+        IGNORED = set(["_FuncPtr", "_name", "_handle"])
+        lib_functions = set(vars(conf.lib).keys())
----------------
Endilll wrote:

Exploring the "list all symbols" solution:

1) I checked what WinAPI calls CPython's `ctypes` do, and there's nothing 
interesting beyond `GetProcAddress`.

2) It seems that there is a WinAPI function to enumerate all exported function 
from a DLL: 
https://learn.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symenumsymbols.
 However, it comes from `dbghelp.dll`, so availability on various Windows 
versions has to be checked.

3) I wasn't able to find anything equivalent for Linux.

4) So it's likely that we need an external tool for this. Using LLVM toolchain, 
here are the best ways I was able to figure out: `llvm-nm --dynamic 
--defined-only` for Linux, `llvm-objdump --private-headers` for Windows (this 
one has additional information that we'd need to filter out).

https://github.com/llvm/llvm-project/pull/140015
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to