<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Noel, hi Thomas,</div><div><br></div><div>thanks for the great help! I will certainly have a look at the reverse engineered protocol because that's fascinating (also I didn't know wireshark, sounds very interesting to try out!), but binding to the C library will surely be the simpler way then...</div><div><br></div><div>And thank you too for the concrete explanations regarding the 32 v. 64 bit issue! </div><div><br></div><div>Interestingly, file doesn't give such a detailed output on my Mac, and as I'm taking off this week I cannot check on Ubuntu at my workplace (I have been using file there and the output was also quite short, but I think I will mostly have used it for non-executables there, e.g. to find out whether something's a symlink or not, so I don't know).</div><div><br></div><div>On my Mac I have e.g.</div><div><br></div><div><div>$ file '/usr/bin/file'</div><div>/usr/bin/file: Mach-O universal binary with 2 architectures</div><div>/usr/bin/file (for architecture i386):<span class="Apple-tab-span" style="white-space:pre">        </span>Mach-O executable i386</div><div>/usr/bin/file (for architecture ppc7400):<span class="Apple-tab-span" style="white-space:pre">        </span>Mach-O executable ppc</div><div><br></div><div>Regarding objdump, this I do not have in Leopard, but I found out that the Mac equivalent is otool, and from a blog post (<a href="http://paulbeachsblog.blogspot.com/2007/12/32bit-or-64bit-binaries-on-macos.html">http://paulbeachsblog.blogspot.com/2007/12/32bit-or-64bit-binaries-on-macos.html</a>) I found how to use it:</div><div><br></div><div><div>$ otool -h /usr/bin/file</div><div>/usr/bin/file:</div><div>Mach header</div><div>magic cputype cpusubtype caps filetype ncmds sizeofcmds flags</div><div>0xfeedface 7 3 0x00 2 14 1296 0x00000085</div><div><br></div><div>And in <span class="Apple-style-span" style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; ">usr/include/mach-o/loader.h I have:</span></div><div><font class="Apple-style-span" face="'Trebuchet MS', Trebuchet, Verdana, sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="'Trebuchet MS', Trebuchet, Verdana, sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px;"><div>/* Constant for the magic field of the mach_header (32-bit architectures) */</div><div>#define MH_MAGIC 0xfeedface /* the mach magic number */</div><div><br></div><div><br></div><div>Ciao,</div><div>Sigrid</div></span></font></div></div><div><br></div></div><div><br></div><div><br></div><br><div><div>Am 23.09.2009 um 10:45 schrieb Noel Welsh:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Wed, Sep 23, 2009 at 9:21 AM, Sigrid <<a href="mailto:keydana@gmx.de">keydana@gmx.de</a>> wrote:<br><blockquote type="cite">As for the network vs. FFI approach, I was searching the Oracle<br></blockquote><blockquote type="cite">documentation for it and it seems to me that the network approach is<br></blockquote><blockquote type="cite">impossible, as it uses a proprietary network protocol (called TTC)<br></blockquote><blockquote type="cite">from Oracle.<br></blockquote><br>AFAIK, you're largely correct but some people have reverse engineered<br>the protocol:<br><br><a href="http://www.oracle-internals.com/?p=22">http://www.oracle-internals.com/?p=22</a><br><br>Probably simpler to just bind the C library.<br><br><blockquote type="cite">may I ask a very stupid question: I don't really know how to find out<br></blockquote><blockquote type="cite">whether a library uses 32bit or 64bit (even I don't know, is this a<br></blockquote><blockquote type="cite">feature of a single library, or of the system)?<br></blockquote><br>Both :) The OS generally has to support 64-bit (like Snow Leopard) but<br>then individual libraries may be 64-bit or 32-bit (if the OS supports<br>this kind of "mixed mode" code, which Snow Leopard does).<br><br><blockquote type="cite">Could you tell me how<br></blockquote><blockquote type="cite">to find out such things on a Mac? (For this, as the concept itself is<br></blockquote><blockquote type="cite">not too clear for me I would not even know how to find out on Linux,<br></blockquote><blockquote type="cite">but I must admit that even if I know something on Linux I sometimes<br></blockquote><blockquote type="cite">have problems when things are different on the Mac...)<br></blockquote><br>file, objdump, or readelf (last is probably Linux specific). Examples on Linux:<br><br><br>~> objdump -f /bham/ums/linux/pd/packages/plt-scheme/bin/mzscheme<br><br>/bham/ums/linux/pd/packages/plt-scheme/bin/mzscheme: file format elf32-i386<br>architecture: i386, flags 0x00000112:<br>EXEC_P, HAS_SYMS, D_PAGED<br>start address 0x0805e570<br><br><br>~> readelf -h /bham/ums/linux/pd/packages/plt-scheme/bin/mzscheme<br>ELF Header:<br> Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00<br> Class: ELF32<br> Data: 2's complement, little endian<br> Version: 1 (current)<br> OS/ABI: UNIX - System V<br> ABI Version: 0<br> Type: EXEC (Executable file)<br> Machine: Intel 80386<br> Version: 0x1<br> Entry point address: 0x805e570<br> Start of program headers: 52 (bytes into file)<br> Start of section headers: 4806288 (bytes into file)<br> Flags: 0x0<br> Size of this header: 52 (bytes)<br> Size of program headers: 32 (bytes)<br> Number of program headers: 8<br> Size of section headers: 40 (bytes)<br> Number of section headers: 38<br> Section header string table index: 35<br><br><br><br>~> file /bham/ums/linux/pd/packages/plt-scheme/bin/mzscheme<br>/bham/ums/linux/pd/packages/plt-scheme/bin/mzscheme: ELF 32-bit LSB<br>executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9,<br>dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not<br>stripped<br><br><br><br>HTH,<br>N.<br></div></blockquote></div><br></body></html>