[squeak-dev] FFI: FFI-Kernel-mt.173.mcz

commits at source.squeak.org commits at source.squeak.org
Wed May 26 16:43:07 UTC 2021


Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.173.mcz

==================== Summary ====================

Name: FFI-Kernel-mt.173
Author: mt
Time: 26 May 2021, 6:43:06.758386 pm
UUID: a4390742-4fe7-0a44-b077-b39954d28611
Ancestors: FFI-Kernel-mt.172

Adds a singleton interface to ExternalLibrary.

=============== Diff against FFI-Kernel-mt.172 ===============

Item was changed:
  ExternalObject subclass: #ExternalLibrary
  	instanceVariableNames: 'name'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'FFI-Kernel'!
+ ExternalLibrary class
+ 	instanceVariableNames: 'default'!
  
+ !ExternalLibrary commentStamp: 'mt 6/8/2020 13:21' prior: 0!
- !ExternalLibrary commentStamp: '<historical>' prior: 0!
  An external library bundles calls to functions from the same library. It is provided mainly as convenience since every external function can be fully specified by the name and the module it resides in.
  
+ Every external function that is defined in an external library by default will use the library it is defined in. This can always be modified by providing the appropriate module in the specification.
+ 
+ Note that you will only get a valid handle *automatically* for the library if the module has not yet been loaded when making the first FFI call. After that, new instances of me must call #forceLoading to get the handle right. Consequently, it is advised to only have a single instance of your external library to reliably check #isLoaded.!
+ ExternalLibrary class
+ 	instanceVariableNames: 'default'!
- Every external function that is defined in an external library by default will use the library it is defined in. This can always be modified by providing the appropriate module in the specification. !

Item was added:
+ ----- Method: ExternalLibrary class>>clearAllCaches (in category 'system startup') -----
+ clearAllCaches
+ 
+ 	self withAllSubclassesDo: [:libraryClass |
+ 		libraryClass clearCaches].!

Item was added:
+ ----- Method: ExternalLibrary class>>clearCaches (in category 'system startup') -----
+ clearCaches
+ 
+ 	self resetDefault.!

Item was added:
+ ----- Method: ExternalLibrary class>>default (in category 'instance access') -----
+ default
+ 
+ 	^ default ifNil: [default := self new]!

Item was added:
+ ----- Method: ExternalLibrary class>>platformChangedFrom:to: (in category 'system startup') -----
+ platformChangedFrom: oldPlatform to: newPlatform
+ 
+ 	self clearAllCaches.!

Item was added:
+ ----- Method: ExternalLibrary class>>resetDefault (in category 'instance creation') -----
+ resetDefault
+ 
+ 	default := nil.!

Item was changed:
  ----- Method: FFIPlatformDescription class>>startUp: (in category 'system startup') -----
  startUp: resuming
  	"Notify all FFI classes about platform changes."
  
  	resuming ifTrue: [
  		LastPlatform in: [:lastPlatform | self newCurrent in: [:currentPlatform |
  			lastPlatform = currentPlatform
  				ifTrue: [
  					self flag: #discuss. "mt: Maybe add #platformResuming?"
  					ExternalAddress allBeNull.
  					ExternalType cleanupUnusedTypes ]
  				ifFalse: [
  					LastPlatform := currentPlatform. "Update now. See #current."
+ 					{ ExternalAddress. ExternalType. ExternalStructure. ExternalPool. ExternalLibrary }
- 					{ ExternalAddress. ExternalType. ExternalStructure. ExternalPool }
  						do: [:cls | cls
  							platformChangedFrom: lastPlatform
  							to: currentPlatform] ]]].
  		self checkFFIOnStartUp ifTrue: [self checkFFI].
  		self checkCStandardLibraryOnStartUp ifTrue: [self checkCStandardLibrary]].!



More information about the Squeak-dev mailing list