[Vm-dev] Howto invoke plugin primitive from Interpreter?

André Wendt andre.wendt at hpi.uni-potsdam.de
Thu Jun 14 14:08:54 UTC 2007


Bert Freudenberg schrieb:
>  
> On Jun 14, 2007, at 14:31 , André Wendt wrote:
> 
>> Bert Freudenberg schrieb:
>>>
>>> On Jun 14, 2007, at 11:28 , André Wendt wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm trying to invoke the primitiveFileOpen primitive from the
>>>> FilePlugin
>>>> from within the Interpreter:
>>>>
>>>> <primitive: 'primitiveFileOpen' module: 'FilePlugin'>
>>>>
>>>> obviously does not work: It doesn't get translated to C. How do I
>>>> invoke
>>>> a primitive of an (internal/external) plugin from within the
>>>> Interpreter
>>>> class?
>>> This is generally a bad idea, because you would have to pass
>>> parameters on the smalltalk stack.
>>>
>>> What are you actually trying to achieve?
>> Hi Bert,
>>
>> I'm trying to write a logging facility for send (sample work for Prof.
>> Hirschfeld, actually): Each time a message is sent, the target class,
>> message and a couple of other properties should be logged.
> 
> I'm pretty sure John McIntosh did that before.
> 
>> That means I have to open a file upon initialization and write the  
>> file
>> at each send. There's no other way than to do that in the Interpreter,
>> as far as I can see.
> 
> What about fopen()?

Do you mean something like

f := self cCode: 'fopen(logFile, "a")'. ??

André


More information about the Vm-dev mailing list