Okay that helps a lot. You've done two things wrong. 1. You actually did.... ExternalStructure subclass: #MyStructure not FFIExternalStructure subclass: #MyStructure
This is what caused the error, since if you compare the class-side methods (by clicking the <Class> button) of ExternalStructure and FFIExternalStructure you'll see only the latter has method #rebuildFieldAccessors. 2. You didn't click the <Class> button before adding method #fieldsDesc. This would trip you up after you fix the above. "MyStructure rebuildFieldAccessors" would no longer produce an error but *nothing* would happen when you evaluate it. When you add #fieldsDesc to the class-side, switch back to the instance-side to observe what happens when you evaluate "MyStructure rebuildFieldAccessors". You'll know you are looking at the class-side when you see the class's class-side definition MyStructure class instanceVariableNames: '' rather than the class's instance-side definition... FFIExternalStructure subclass: #MyStructure instanceVariableNames: '' classVariableNames: '' package: 'FFIDemo' Pay attention that the documentation says MyStructure class>>#fieldsDesc rather than MyStructure>>#fieldsDesc The former is a method on the class-side and the latter is a method on the instance-side. A weak analogy is that you can think of class-side methods as the methods of MyStructure factory that produces the the Mystructure objects. Actually I can see how "MyStructure class>>#fieldsDesc" can be ambiguous to newcomers. Your mind has not yet been conditioned to catch on that detail and and glosses over it unconsciously thinking "yes, I know MyStructure is a class. I'm adding a method to it". This is something that often catches newcomers. I remember getting caught on it myself. Makes me wonder if documentation instead using "MyStructure classside>>#fieldsDesc" is more intention revealing, and making the browser button match this as <Class Side> would make working with instance/class-side more obvious to newcomers. cheers -ben On Thu, Apr 20, 2017 at 1:52 PM, Yuriy Babah <babah.yuri...@gmail.com> wrote: > > I have recorded screencast abaut this my operations with Pharo. > > https://drive.google.com/open?id=0B_0p5J9SNPlBOHduQlIxdHI0bk0 > > But sometimes I'm moved forvard to operations: > > MyStructure rebuildFieldAccessors. -> DoIt -> Ok > > myStruct := MyStructure externalNew. -> DoIt -> Ok > > myStruct := id: 42. -> MessageDoesUnderstood. > > I'm doesn't understand in which cases i got to this moment. > > I'm associete that with that what i have a several copy's Pharo. > And somebody affect to other. > > 2017-04-19 18:46 GMT+04:00 Ben Coman <b...@openinworld.com>: >> >> Hi Yuriy, >> >> Hope I can help. I tried your example in build 60463 and its works fine. >> So lets break it down. >> >> On Wed, Apr 19, 2017 at 8:46 PM, Yuriy Babah <babah.yuri...@gmail.com> wrote: >>> >>> Hello everyone, >>> >>> I'm new to Pharo and have tried do example with structure in Unified FFI >>> manual. >>> >>> FFIExternalStructure subclass: #MyStructure >>> instanceVariableNames: '' >>> classVariableNames: '' >>> package: 'FFIDemo' >> >> >> You opened a System Browser and entered and accepted the above first on its >> own, >> such that the new package & class were added and the new class selected. >> >> Then you clicked on the <Class> button, such that the "no messages" text in >> the third pane changed from >> normal font to bold font. Then clicked on "no messages" to display the >> method template.... >> messageSelectorAndArgumentNames >> "comment stating purpose of message" >> | temporary variable names | >> statements >> >> And replaced that text with the text below from "fieldsDesc" onwards, >> the Accepted that. >> >>> >>> MyStructure class>>#fieldsDesc >>> ^ #( >>> uint8 id; >>> char * struct_name; >>> uint name_length; >>> ) >>> >> >> Then separately you evaluated(doIt) the following... >> >>> >>> MyStructure rebuildFieldAccessors >> >> >> >>> >>> . -> DoIt -> MessageNotUnderstood >>> >>> What's i do wrong? >> >> >> Does a debug window appear? What is the exact text of the title bar, >> which details which message is not understood by which class. >> This provides an important hint to what is wrong. >> >> Further help might need a live chat. I'll be in discord for a couple of >> hours, but ask anyone there... >> https://discord.gg/KCKQSSt >> >> cheers -ben >> >>> I do it in >>> Pharo5 and 6, widows and os x. >>> Sorry for my english, it's not my native language. >>> >> >> Your english is not too bad :) >> >> cheers -ben > >