CStruct subclass: #Bar declaration: #((#aString #string) (#anotherNumber #int)) classVariableNames: '' poolDictionaries: '' category: '' ! CStruct subclass: #Foo declaration: #((#aNumber #int) (#bar (#ptr #Bar))) classVariableNames: '' poolDictionaries: '' category: '' ! DLD addLibrary: './testcase'. Object subclass: Testcase [ | foo | primMakeFoo: aNumber str: aString num: anotherNumber [ ] makeFoo: aNumber str: aString num: anotherNumber [ | result | result := self primMakeFoo: aNumber str: aString num: anotherNumber. result changeClassTo: Foo. ^ result ] run [ foo := self makeFoo: 123 str: 'hello' num: 234. Transcript << 'Foo: ' << foo; nl. Transcript << 'Foo aNumber: ' << foo aNumber; nl. Transcript << 'Foo aNumber value: ' << foo aNumber value; nl. Transcript << 'Foo bar: ' << foo bar; nl. Transcript << 'Foo bar value: ' << foo bar value; nl. Transcript << 'Foo bar value aString: ' << foo bar value aString; nl. Transcript << 'Foo bar value aString value: ' << foo bar value aString value; nl. Transcript << 'Foo bar value anotherNumber: ' << foo bar value anotherNumber; nl. Transcript << 'Foo bar value anotherNumber value: ' << foo bar value anotherNumber value; nl. ] ]. Testcase new run.