[Pyobjc-dev] Re: pyobj-c bridge questions
Brought to you by:
ronaldoussoren
|
From: Bill B. <bb...@co...> - 2002-10-16 18:51:05
|
You are correct. It is very wrong. I fixed this problem and several
others in the main [and currently proprietary] project that I'm working
on that uses the bridge, I just hadn't had a chance to migrate the code
back into the bridge.
I apologize for the inconvenience.
If you grab the latest code from the CVS repository, the Web Services
Tool example has been updated appropriately to reflect the new
implementation. Of note:
- I changed memory management semantics. Namely, the main()
function no longer releases anything. It isn't necessary. As soon as
the call to execve() is made, the original process is completely
destroyed.
- I fixed the bug that Joe so graciously pointed out.
- The main() function now walks the list of frameworks that are
linked into the command line executable and creates an argument to the
python interpreter that lists all of the frameworks.
- The argument used in the previous step is used by the Main.py
file to automatically load all frameworks that were linked into the
original bootstrapper. As well, if any of the frameworks have an
"Init.py" file in their resources, it is executed.
The end result is that mixing in compiled ObjC classes into your
PyCocoa application is as easy as adding a framework target to your
project and linking it into the target that compiles bin-python-main.m.
(Of interest -- the proprietary project I'm working on is a custom
Cocoa XML-RPC client to www.intentcenter.com. It uses Python to do all
of the server interaction and a slew of Cocoa classes to implement the
UI. The Python code is replacing an initial implementation against
the CoreWebServices framework. By moving to Python with PyObjC, I have
been able to cut something like 1,000 lines of really gnarly C code
while greatly improving the quality of implementation/interaction with
the server.)
I'll update the Project Builder template to reflect the new code.
b.bum
On Wednesday, October 16, 2002, at 02:24 PM, Joseph Grace wrote:
> Hi Bill:
>
> Thank you for the bridge. If you're too busy to answer a couple of
> curiosity questions, I understand. On the chance that these are
> quickies, here goes...
>
> 1. I am curious about the code in main-bin-python.m. Is it really
> supposed to be:
>
> childArgv[0] = argv[0];
> childArgv[1] = mainPyPathPtr;
> for (i = 1; i<argc; i++)
> childArgv[i+2] = argv[i];
> childArgv[i+2] = NULL;
>
> My logic tells me it should rather be:
>
> childArgv[0] = argv[0];
> childArgv[1] = mainPyPathPtr;
> for (i = 1; i<argc; i++)
> childArgv[i+1] = argv[i]; // i+2 becomes i+1?
> childArgv[i+2] = NULL;
>
> ? I'm not very confident though, so I thought I would mention it (in
> case it is a minor bug), or perhaps learn something so the code makes
> sense to me.
>
> 2. I am trying to rebuild the project (so I could test my theory
> about the bug, above, and just generally be able to use the code) and
> am getting an error: "Error from Debugger: mi_cmd_stack_list_frames:
> Not enough frames in stack." Is there any trick to debugging or
> building the project?
>
> Excellent work (I'll love it to learn Cocoa from python :-). I look
> forward to understanding how you work the magic, and how to use python
> anc Cocoa.
>
> Cheers,
>
> = Joe =
>
>
b.bum
I ride tandem with the random....
.... things don't run the way I planned them.
|