]> gitweb.factorcode.org Git - factor.git/commitdiff
get symbols out of a dylib and map the C++ ones to their demangled names
authorJoe Groff <arcata@gmail.com>
Wed, 14 Apr 2010 22:52:46 +0000 (15:52 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 14 Apr 2010 22:52:46 +0000 (15:52 -0700)
extra/alien/cxx/scaffold/scaffold.factor [new file with mode: 0644]

diff --git a/extra/alien/cxx/scaffold/scaffold.factor b/extra/alien/cxx/scaffold/scaffold.factor
new file mode 100644 (file)
index 0000000..603d5d0
--- /dev/null
@@ -0,0 +1,15 @@
+! (c)2010 Joe Groff bsd license
+USING: alien.cxx.demangle assocs combinators fry io.pathnames
+kernel macho sequences ;
+IN: alien.cxx.scaffold
+
+: library-symbols ( file -- symbols )
+    dup file-extension {
+        { "dylib" [ dylib-exports ] }
+        { f       [ dylib-exports ] }
+    } case ;
+
+: c++-library-symbols ( file abi -- symbols )
+    [ library-symbols ] dip
+    [ '[ _ c++-symbol? ] filter ]
+    [ '[ dup _ demangle ] H{ } map>assoc ] bi ;