[comp.lang.smalltalk] C to Smalltalk

jaz@icd.ab.com (Jack A. Zucker) (08/24/90)

I know this is a naive question, but is it possible to
call smalltalk methods from C using either the Digitalk
or Park Place products ?

-jaz

obrien@aerospace.aero.org (Michael O'Brien) (08/24/90)

In article <1780@abvax.UUCP>, jaz@icd.ab.com (Jack A. Zucker) writes:
|> I know this is a naive question, but is it possible to
|> call smalltalk methods from C using either the Digitalk
|> or Park Place products ?

	Goodness knows what ParcPlace has planned for the future - they
are enough of a business now not to let much out - but in the current
release it's definitely impossible.  The VM which runs the whole show
is a separate process, and while you can link your own code into the VM
as a set of primitive methods, the VM is definitely in control.  Of
course when your own primitive method code is running YOU are in
control, but since you don't really have a handle on things like
terminal I/O, the rest of Smalltalk is just sort of dead in the water,
and hence so is the window it's running in.

	About the best you could hope for is to fire up a Smalltalk
image with a set of RPC stubs in it, and call it via RPC's.  Some folks
are working on methods for this but nothing's really released yet.  It's
slow and awkward.

	I haven't used Digitalk Smalltalk yet, but since it also is
based on the use of a separate VM process, it probably has the same
shortcomings.
--
Mike O'Brien
obrien@aerospace.aero.org

warner@scubed.com (Ken Warner) (08/24/90)

In article <81923@aerospace.AERO.ORG> obrien@aerospace.aero.org (Michael O'Brien) writes:
>
>In article <1780@abvax.UUCP>, jaz@icd.ab.com (Jack A. Zucker) writes:
>|> I know this is a naive question, but is it possible to
>|> call smalltalk methods from C using either the Digitalk
>|> or Park Place products ?
>
>	Goodness knows what ParcPlace has planned for the future - they
>are enough of a business now not to let much out - but in the current
>release it's definitely impossible.  

------- THIS IS NOT A FLAME ----------

I am curious.  What sort of things did you (Jack) want to do that you feel are
best done in this way.  And why could you not go the "other" way by calling C
functions via primitives from Smalltalk?  

One wild blue approach to calling Smalltalk from C (just off the top of my 
early morning head) would be to supply a set of entry points into a VM by
installing a set of of primitives.  Then link the VM into a C object.  Pretty
wild huh?  I wonder what it would take to do this. I have a real strong feeling
that this can't be done with the current VM.  It's just a thought for the sake 
of brain-storming.

Ken Warner

obrien@aerospace.aero.org (Michael O'Brien) (08/25/90)

|> >
|> >In article <1780@abvax.UUCP>, jaz@icd.ab.com (Jack A. Zucker) writes:
|> >|> I know this is a naive question, but is it possible to
|> >|> call smalltalk methods from C using either the Digitalk
|> >|> or Park Place products ?
|> >
|> In article <81923@aerospace.AERO.ORG> obrien@aerospace.aero.org
(Michael O'Brien) (That's me folks) replies:
|> >	Goodness knows what ParcPlace has planned for the future - they
|> >are enough of a business now not to let much out - but in the current
|> >release it's definitely impossible.  
|> 
In article <381@scubed.SCUBED.COM>, warner@scubed.com (Ken Warner) writes:
|> ------- THIS IS NOT A FLAME ----------
|> 
|> I am curious.  What sort of things did you (Jack) want to do that you
feel are
|> best done in this way.  And why could you not go the "other" way by
calling C
|> functions via primitives from Smalltalk?

	Obviously I'm not Jack, but on my part, I found early on that if you
could call a given package from C, you could usually call it from any damn
thing.  My first big Smalltalk project was to do a user interface to a giant
Prolog system.  Prolog could call C, or thought it could, and so I could
have had the interface bound into the Prolog system - except that Smalltalk
couldn't be called by C.

	In the end I wound up doing it in reverse: Quintus Prolog defined
a funky pseudo-RPC interface to allow itself to be called by C (i.e. going
the opposite way).  I put protocol stuff into the ParcPlace VM to do the
job and away we went.  Luckily UI things operate on a time scale that allowed
the RPC overhead.
|> 
|> One wild blue approach to calling Smalltalk from C (just off the top of my 
|> early morning head) would be to supply a set of entry points into a VM by
|> installing a set of of primitives.  Then link the VM into a C object.
Pretty
|> wild huh?  I wonder what it would take to do this. I have a real
strong feeling
|> that this can't be done with the current VM.  It's just a thought for
the sake 
|> of brain-storming.

	Well, I don't think this would really work, since for one thing the
load module would wind up with two "main()"s.  And Smalltalk wouldn't get
to initialize its image, and, and, and...
--
Mike O'Brien
obrien@aerospace.aero.org

jaz@icd.ab.com (Jack A. Zucker) (08/27/90)

In article <381@scubed.SCUBED.COM>, warner@scubed.com (Ken Warner) writes:
> In article <81923@aerospace.AERO.ORG> obrien@aerospace.aero.org
(Michael O'Brien) writes:
> >
> >In article <1780@abvax.UUCP>, jaz@icd.ab.com (Jack A. Zucker) writes:
> >|> I know this is a naive question, but is it possible to
> >|> call smalltalk methods from C using either the Digitalk
> >|> or Park Place products ?
> >
> 
> I am curious.  What sort of things did you (Jack) want to do that you
feel are
> best done in this way.  And why could you not go the "other" way by calling C
> functions via primitives from Smalltalk?  
> 

I am interested in building libraries using Smalltalk that are usable
(callable)
from other languages such as C, Pascal, Assembler, etc.

-jaz

*****************************************************************************
*****************************************************************************
*****************************************************************************