Newsgroups: comp.lang.smalltalk,comp.lang.c
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!newsfeed.internetmci.com!in1.uu.net!news.fyi.net!news
From: fireresq@fyi.net
Subject: VisualAge IBM Smalltalk Primiative Problem
X-Nntp-Posting-Host: 204.179.83.8
Message-ID: <DLM6xL.HKz@fyi.net>
Keywords: Smalltalk C Primative
Sender: news@fyi.net (News User)
Reply-To: fireresq@fyi.net
Organization: MRR BlackSmithing
X-Newsreader: IBM NewsReader/2 v1.2
Date: Tue, 23 Jan 1996 03:27:20 GMT
Lines: 56
Xref: glinda.oz.cs.cmu.edu comp.lang.smalltalk:33828 comp.lang.c:171736

this is the definition of the array that gets passed to my c primative:
| ary |
	ary := Array new: 6.
	ary at: 1 put: #name:.
	ary at: 2 put: #makeProcWithName:.
	ary at: 3 put: #uuid:.
	ary at: 4 put: #version:.
	ary at: 5 put: #makeConstWithName:.
	ary at: 6 put: #putConstType:inConst:withValue:.

this is the code that that will be called by the EsSemdMessage:
putConstType: aTypeString inConst: aClConstant withValue: anObject
	"Test:

this is the section of code that will exicute in the c dll to call back to
SmallTalk:
   EsObject          result;
   EsObject          s1, s2, s3;
   EsObject          selector;

   s1 = createString(EsPrimVMContext, "s1");
   s2 = createString(EsPrimVMContext, "s2");
   s3 = createString(EsPrimVMContext, "s3");
   selector = EsAt(selectorArray, (U_32) 6);
   rc = EsSendMessage(EsPrimVMContext, &result, parserClass, selector,
                        3, s1, s2, s3);

This is a c function to create a string object:
EsObject createString(EsVMContext EsPrimVMContext, char * str)
{
   EsObject result;
   U_32 i, size;

   size = strlen(str);
   result = EsAllocateObject(EsPrimVMContext,EsPrimClassString,
                             size, 0, (EsObject **) NULL);
   if (result != (EsObject) NULL)
      for (i = 0; i < size; ++i)
         EsByteAtPut(result, i + 1, (U_8) str[i]);

   return(result);
}

I hope I have given you enough information to make suggestions.  If noe please
feel free to ask me questions on this news group or by e-mail.

1) My question is everytime i make the call to #putConstType:inConst:withValue:
I get a 21 returned from EsSend Message.  Does Anyone know what this means?

2) Does onyone know a better way of getting selectors to make call backs to
SmallTalk?

Thanks in advance for your help!
Mark Russell
Owner MRR Blacksmithing
fireresq@fyi.net
