Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!udel!gatech!howland.reston.ans.net!math.ohio-state.edu!caen!msunews!harbinger.cc.monash.edu.au!news.cs.su.oz.au!tmx!news.tmx.com.au!news
From: philip <philip@oose.com.au>
Subject: Re: Calling Smalltalk from C
Message-ID: <D3nKKo.Jyp@online.tmx.com.au>
Nntp-Posting-Host: 203.5.19.189
Sender: news@online.tmx.com.au (System Administrator)
Organization: The Message eXchange Pty Ltd
Date: Tue, 7 Feb 1995 23:14:47 GMT
References:  <D3nFDq.K8C@world.std.com>
Lines: 25

edwards@world.std.com (Jonathan Edwards) wrote:
>
> Does anyone know of a way to call Smalltalk from C?
> All the Smalltalks I have seen support call-OUTs and call-BACKs but not
> call-INs.

The exact details of calling Smalltalk from C naturally depends on 
the variant of Smalltalk you are using. However, the following is 
the approach that I have used success with both VOS & VisualWorks 1.0
under Unix.

(1) Have Smalltalk in one process, the C/C++ program in another.
(2) Create a Smalltalk thread which sits on a semaphore.
(3) The C program writes data to a common buffer.
(4) C program sends signal to Smalltalk to read buffer. Either
    a custom window message (V) or a IPC signal will do (VW).
(5) Smalltalk program goes & reads data, spawns another ST thread
    to act on the data.
(6) Smalltalk waits for next message.

Hope this helps.
Regards
Philip Haynes
Object Oriented Pty Ltd.

