On Dec 14, 2013, at 7:27 PM, Max Leske <maxleske@gmail.com> wrote:

Did you check that the library has benn compiled with a C compiler? C++ name mangling doesn�t work with NB.

but name is been resolved :(

Another thing you can do is to attach gdb to the image and break on the gtk_init call. That way you can see at what stage approximately the error occurs.

yeah... I expect to avoid that, unless I have no other choice :)


Esteban




On 14.12.2013, at 17:11, Esteban Lorenzano <estebanlm@gmail.com> wrote:

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