In article <1179818595.448937.206180@[EMAIL PROTECTED]
>,
chris@[EMAIL PROTECTED]
wrote:
> I will try to understand better your suggestion for the intermediate
> shared bundle. Forgive me for my slowness, I'll need to tinker with
> this to understand it.
In essence it's about two running applications using a framework
or bundle to communicate; i.e. both apps are literally sharing a
loaded framework/bundle. The calling app uses ex****ted functions
from the framework, which will execute code from the serving app,
in a callback context. The framework is an in-between.
I tried this, but failed so far. The MF part and framework works.
Connecting another app to this same framework fails, which makes
sense in this OS of course. Perhaps I'm missing out on something
and it _is_ possible. I give myself 2 more days hitting my head
against the wall. It's probably just a dead end.
For info sake, here's the code:
apologies for the C code, I'm not used to it.
In XCode create a new project named: test
type: Carbon Framework
Code is set to PPC only using the project info tab
Use the supplied code for main.c file,
Build framework is stuffed in /Library/Frameworks/
<c code>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdio.h>
typedef void (*FunctionPtr)(void);
FunctionPtr foo;
short setCallBack( FunctionPtr callBackFunctionPtr )
{
foo = callBackFunctionPtr;
return( 0 );
}
short runCallBack()
{
foo();
return( 0 );
}
</c code>
the Forth code, loaded in a running MF.
<forth code>
\ include the shared framework or bundle
globalbundle /library/frameworks/test.framework
\ select it
test.framework
\ im****t needed functions
1 machofunc _setCallBack
0 machofunc _runCallBack
\ MF 'ex****ted' word
: beeps 5 0 do 5 _SysBeep 100 ms loop ;
\ prepare as callback for macho-o environment
0 ' beeps MakeMachCallback *beeps
\ store it in functionpointer from framework
*beeps _setCallBack drop
\ run it, here to test, in reality runCallBack should be run by
\ another app connected to the same framework.
: bbbbbeep _runCallBack drop ;
prior.stream
</forth code>
If, big if, it could be made to work as intended, then add an init
function in the framework which launches MF, which after booting
connects to the framework and initializes the pointers with the ex****ted
MF word tokens and then just 'sits' doing nothing, just providing the
context for the ex****ted words.
The other application just loads the framework, im****ts what's needed,
calls init and do whatever it wants to do next.
groeten
-Roelf


|