[Pharo-dev] NB FFI problem (calling an universal library)

Esteban Lorenzano estebanlm at gmail.com
Sat Dec 14 11:11:28 EST 2013


Hi,

I'm trying to create some stuff with Gtk3, and because of it I have a call to gtk_init using NB-FFI. The call is like this:

gtkInitArgC: argc argV: argv
	<primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode>
	^ self nbCall: #( void gtk_init ( int *argc, char ***argv ) )
	

and well, I have a GtkLibrary copied from CairoLibraryLoader who loads the library. 

system is 64bits, but Gtk3 libraries are "universal" compiled (it has both formats, i386 and x86_64 inside).

GtkLibrary loadGtkLibrary actually loads the library (it answers a pointer to it) and in fact, following the stack track NB is resolving correctly gtk_init symbol... 

Now, the problem is that a call to 

self gtkInitArgC: 0 argV: 0. 

fails... with this stack trace: 

NBFFICallout class>>signalError:
NBFFICallout class(NBNativeCodeGen class)>>handleFailureIn:nativeCode:
NBFFICalloutAPI>>function:module:
GtkApplication(Object)>>nbCall:
GtkApplication>>gtkInitArgC:argV:
NBFFICallout class(NBNativeCodeGen class)>>retrySend:
GtkApplication>>gtkInit
GtkApplication>>initialize
GtkApplication class(Behavior)>>new
MarsApplication>>platformApplication
MarsApplication>>stop
MarsApplication>>start
UndefinedObject>>DoIt
OpalCompiler>>evaluate
SmalltalkEditor>>evaluateSelectionAndDo:
SmalltalkEditor>>evaluateSelection
PluggableTextMorph>>doIt in Block: [ textMorph editor evaluateSelection ]
PluggableTextMorph>>handleEdit: in Block: [ result := editBlock value ]
TextMorphForEditView(TextMorph)>>handleEdit:
PluggableTextMorph>>handleEdit:
PluggableTextMorph>>doIt
SmalltalkEditor class>>buildSmalltalkEditorKeymappingsOn: in Block: [ :morph | morph doIt ]
BlockClosure>>cull:
BlockClosure>>cull:cull:
BlockClosure>>cull:cull:cull:
KMCategoryBinding>>completeMatch:buffer:
KMKeymap>>notifyCompleteMatchTo:buffer: in Block: [ :l | l completeMatch: self buffer: aBuffer ]
Array(SequenceableCollection)>>do:
KMKeymap>>notifyCompleteMatchTo:buffer:
KMKeymap>>onMatchWith:notify:andDo:

and #signalError: argument (errorCode) is nil.

any idea?

thanks, 
Esteban



More information about the Pharo-dev mailing list