<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>On Mon, Nov 10, 2008 at 5:44 PM, David Chisnall <span dir="ltr"><<a href="mailto:csdavec@swansea.ac.uk" target="_blank">csdavec@swansea.ac.uk</a>></span> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On 10 Nov 2008, at 14:41, Dado Colussi wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello everybody,<br>
<br>
I am new to this list, and my inexperience in compiler technology is<br>
likely to shine in my questions. Here we go...<br>
<br>
I am interested in trying to use clang to convert Objective-C code to<br>
C, and compiling the generated C code with 3rd party compiler. I have<br>
managed to convert and compile a very simple hello application on my<br>
Mac using Apple's runtime after having tweaked the generated code. I<br>
have failed with anything more complex than the hello in one file.<br>
</blockquote>
<br></div>
What problem are you trying to solve?  If you want to compile ObjC code on OS X with a different compiler, then this is possible.  If you want to target a different platform, then you will need to tweak the rewriter to support the GNU runtime (not difficult, and something that's on my todo list, but very low down).<br>


<br>
If you are targeting OS X, then you must have a good reason for picking your other compiler instead of GCC or LLVM.  Presumably language support isn't the reason.  If it is performance, then you will have some other issues since the rewriter does not produce particularly good code.  As I recall, it looks up the selectors from strings on every message send (which is very expensive) while this is usually done at module load time.  If you are using GNUstep instead of Cocoa then you will find most headers are safe to use with #include instead of #import (the FSF-GCC guys tried to drop support for #import a few years ago, made everyone change their code, and then realised that it was a silly idea since Apple weren't going to drop #import in their branch and break everyone's code), but third-party frameworks may not be.  One option here is to use the clang preprocessor and then the rewriter on the preprocessed output and then pass this to your other compiler.<br>

<font color="#888888">
<br>
David<br>
</font></blockquote></div><br><div><br></div><div>Hi David,</div><div><br></div><div><div>I am trying to exploit optimizations of vendor specific compilers for an application with intensive mathematics. As I am ultimately targeting a different platform, it seems that I would have to tweak the rewriter, as well as write a new runtime because GNU runtime has license issues in commercial use when compiled with other compilers than GCC.</div>

<div><br></div><div>Thanks for your help!</div><div><br></div><div>/Dado</div><div><br></div></div>
</body></html>