Using the AbtRecord class with C
For C, use the following code:
"Parses the header file and saves the resulting object table"
| anObjectTable |
anObjectTable := AbtCLangParser parseFile: 'catm.h'.
anObjectTable saveToFile: 'c:\catm.rec'
"Restores the object table from the file and
calls the function using a generic record"
| anObjectTable aSampleCATMGenericRecord platformFunction |
anObjectTable := AbtObjectTable loadFromFile: 'c:\catm.rec'.
aSampleCATMGenericRecord := (anObjectTable dataStructures
at: 'ATM_CUSTOMER' asSmalltalkGlobalIdentifier) newRecord.
aSampleCATMGenericRecord at: 'pinNumber' put: '12345'.
platformFunction := PlatformFunction
callingConvention: 'c'
function: 'atm'
library: 'catm'
parameterTypes: #(uint32 pointer)
returnType: #none.
platformFunction coroutineCallWithArray:
(Array
with: 1
with: (aSampleCATMGenericRecord
abtAsExternalPassedPointer))
threadKey: nil.
Transcript
show: (aSampleCATMGenericRecord at: 'firstName'); cr;
show: (aSampleCATMGenericRecord at: 'lastName'); cr;
show: (aSampleCATMGenericRecord at: 'checkingBalance'); cr.
Last modified date: 01/29/2015