foreign, functions and gemstone
TRANSCRIPT
-
8/7/2019 Foreign, Functions and GemStone
1/21
ForeignFunctions and GemStone
Martin McClure2011 Smalltalk Solutions
-
8/7/2019 Foreign, Functions and GemStone
2/21
ForeignFunctions
-
8/7/2019 Foreign, Functions and GemStone
3/21
-
8/7/2019 Foreign, Functions and GemStone
4/21
GemStone/S
-
8/7/2019 Foreign, Functions and GemStone
5/21
GemStone/S
Smalltalk Implementation Headless Shared transactional persistence
Shared image Commit merges concurrent changes Large
Thousands of concurrent VMs Terabyte scale
Fast
Thousands of commits/sec
-
8/7/2019 Foreign, Functions and GemStone
6/21
GemStone/S Client/ServerProcess Architecture
-
8/7/2019 Foreign, Functions and GemStone
7/21
GemStone/S Client/ServerProcess Architecture
-
8/7/2019 Foreign, Functions and GemStone
8/21
ForeignFunctionsandGemStone
-
8/7/2019 Foreign, Functions and GemStone
9/21
The WayIt's Been:
User Actions
-
8/7/2019 Foreign, Functions and GemStone
10/21
To build a user action library
Include gciua.hf in your C source code. Define the initialization and shutdown
functions. Compile with shared library switches. Link with gciualib.o and shared library
switches. Install the library in the $GEMSTONE/ualib
directory.
-
8/7/2019 Foreign, Functions and GemStone
11/21
Powerfulbut Painful
-
8/7/2019 Foreign, Functions and GemStone
12/21
FFI inGemStone/S
64-bit 3.0
-
8/7/2019 Foreign, Functions and GemStone
13/21
CPointer
Creation protocol newNull newFrom: aCByteArray
Instance protocol memoryAddress
-
8/7/2019 Foreign, Functions and GemStone
14/21
CByteArray
Creation protocol malloc: numBytes gcMalloc: numBytes fromCPointer: aCPointer numBytes: anInt
Instance protocol int8At: zeroBasedOffset int64At: zeroBasedOffset put: anInteger stringFromCharStarAt: zeroBasedOffset newFrom: anOffset numBytes: anInt
-
8/7/2019 Foreign, Functions and GemStone
15/21
CLibrary
Creation protocol named: libraryName
Instance protocol load
-
8/7/2019 Foreign, Functions and GemStone
16/21
CCallout
Creation protocol library: aCLibrary name: aName result: resType
args: argumentTypes
(types: #int64, #uint8, #ptr, #'char*', ...) Instance protocol
callWith: argsArray
-
8/7/2019 Foreign, Functions and GemStone
17/21
CCallin
Creation protocol name: aName result: resType args:
argumentTypes
-
8/7/2019 Foreign, Functions and GemStone
18/21
-
8/7/2019 Foreign, Functions and GemStone
19/21
What's Next?
Structs Pointer types? ???
-
8/7/2019 Foreign, Functions and GemStone
20/21
Try It!
ftp://ftp.gemstone.com/pub/GemStone64/
-
8/7/2019 Foreign, Functions and GemStone
21/21
?Martin McClure2011 Smalltalk Solutions