I think that the i386 mach_inject has hit svn already.. Check the extendamac archives.

As for variable vs. fixed length instructions.. I think there's a preamble on every i386 function anyway that can be (ab)used to replace functions. PyObjC doesn't need that functionality though, it only needs to load new code, not override anything.


On May 9, 2006, at 8:49 AM, Saggau wrote:

Do not envy the folks working on mach_inject for Intel, for they shuttle strange rocks up steep hills.  The PPC mach_inject, originally written by a really fabulous cat called Jonathan "Wolf" Rentzsch, can assume (thanks to the RISC instruction set of the PPC) that instructions are of fixed-length.  Our new macintels have the advantage/disadvantage that comes with instructions of variable length (wikipedia: RISC CISC).  The genius of mach_inject just got a whole lot harder to implement because running that first injected bit of code now requires some mechanism for knowing how long it is other than "it's this.  always."  The good news is that "Wolf" and co. appear to be approaching a solution!  It also looks like the "Wolf" part of that equation is going to find some time to chew on this problem soon.  He's rather in demand these days... 

We wait, but we probably won't wait long.  :)


PS -
Right now we'll stay the course with instruction overwriting, but be 
aware we have instruction insertion in our back pocket if x86
hack-arounds sufficiently pisses us off.
" - Jonathan "Wolf" Rentzsch on http://sourceforge.net/mailarchive/forum.php?thread_id=10018617&forum_id=1295
On 5/9/06, Ronald Oussoren <ronaldoussoren@mac.com> wrote:

On 9-mei-2006, at 12:18, ytrewq1 wrote:

> Thanks to the help I received here, I've gotten most of my plug-ins
> working as Universal binaries.  One of the remaining ones is basically
> a wrapper around a couple of the Inject examples.  I get the following
> error when I try to run the examples:
> NotImplementedError: objc.inject is only supported on Mac OS X 10.3
> and later

That message isn't entirely true anymore, objc.inject also isn't
supported on x86 systems. I disabled it when I did the initial port
and haven't looked at it afterwards because I don't use the
functionality myself.

IIRC mach_inject doesn't work on darwin/x86 unless you have special
privileges (aka "you're root"). Independent of this someone would
have to write the assembly
code that is used as the stub that is injected into the host
application. I've seen enough assembly code while porting libffi, and
my assembly skill isn't good enough to actually do the work anyway.

However, it seems a port of mach_inject (which objc.inject wraps) to
intel is in progress (see the extendamac archives at http://
sourceforge.net/mailarchive/forum.php?forum_id=1295), maybe we can
use that whenever it is finished.

> I take it this is related to what is mentioned about mach_inject at:
> http://bob.pythonmac.org/archives/2005/06/06/python-on-mac-os-x-x86/

Not really.
> Is there any hope of getting this to work?  I've found the inject
> interpreter
> functionality to be a great help in developing plug-ins as the
> number of
> times I restart the host application has been reduced tremendously
> and the
> interactive development style enabled is a big plus.
> Is the following relevant to this issue?
> http://guiheneuf.org/Site/mach%20inject%20for%20intel.html

I cannot comment on this page because I cannot open this URL (server
stops responding).


> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
> _______________________________________________
> Pyobjc-dev mailing list
> Pyobjc-dev@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev

The extent to which an individual can resist being blindly led by tradition is a good measure of his vitality.  - Harry Partch

There is a computer disease that anybody who works with computers knows about. It's a very serious disease and it interferes completely with the work. The trouble with computers is that you 'play' with them! - Richard P. Feynman

Few people are capable of expressing with equanimity opinions which differ from the prejudices of their social environment.  Most people are not even capable of forming such opinions.  - Einstein