02:13:32: <noida> hey arai do you think its possible (im thinking it should be) to get into xpcom from ctypes with vtables?
02:13:54: <noida> or does it have to be exposed with extern c first or something?
02:14:35: <Arai> Possible, I guess
02:15:02: <Arai> What you need is figuring out the converted function name
02:15:04: <noida> even without an extern c?
02:16:06: <Arai> Do you know that the function symbol name in C++ is different from C?
02:17:07: <noida> would it be ok if i eventually write up how to use xpcom on mdn? :D
02:17:52: <Arai> a bit scary
02:18:03: <noida> ah ok as it might lead to exploits?
02:18:44: <Arai> actually I'm not sure what would happen with it
02:22:45: <Arai> so, if you've compile it as C, you'll see "0000000100000f70 T _someFunction" in nm output
02:22:57: <Arai> the address will be different tho
02:23:03: <Arai> only leading "_"
02:23:39: <Arai> if you compile it as C++, you'll see "0000000100000f70 T __Z12someFunctioni"
02:23:54: <noida> is it always Z12 ?
02:24:17: <Arai> they express the function's type information
02:24:32: <Arai> so, you can overload it
02:25:02: <noida> would i be able to see the c++ and c names on dxr?
02:25:15: <Arai> I guess no
02:25:40: <Arai> you'll have to calculate it, or just find it in compiled binary
02:25:52: <noida> so using XPCOM is very different from using COM?
02:26:27: <Arai> I guess COM is usable from C
02:27:09: <Arai> (as the C example in COM from js-ctypes page work) https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Examples/Using_COM_from_js-ctypes
02:27:10: <Arai> but I'm not sure about XPCOM
02:27:24: <Arai> if it's usable only from C++, it would be different
02:29:14: <Arai> searching the symbol name rule... it looks like hell http://en.wikipedia.org/wiki/Name_mangling#How_different_compilers_mangle_the_same_functions
02:29:38: <Arai> I thought there're relevant bug for js-ctypes
02:30:28: <Arai> ah, it's here https://bugzilla.mozilla.org/show_bug.cgi?id=770880
02:43:50: <Arai> one more message from it "as it's not yet implemented, you should have to do it yourself" ;)
02:43:52: <noida> about: http://en.wikipedia.org/wiki/Name_mangling#How_different_compilers_mangle_the_same_functions
02:44:07: <noida> couldnt we just look up what compiler ff uses and easily figure it out?
02:44:46: <Arai> I don't know if the information is embedded in binary
-
-
Save Noitidart/a5dd37346d1461cab659 to your computer and use it in GitHub Desktop.
me and arai chat on using xpcom from jsctypes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment