|
Post by Adam on Jan 14, 2009 15:41:27 GMT -5
When returning a type from a plugin (freebasic), what is the major and minor fields used for?
"RT(n,ma,mi)"
|
|
|
Post by DJLinux on Jan 14, 2009 16:15:15 GMT -5
hType=RT(name,major,minor) RT means [r]egister [t]ype not STR(handle,value) et [t]ype [r]esult
you can define your own major,minor numbers can be usefull if two plugins shares a user defined data type
but i have never tryed to share a data type between two plugins
Joshy
an other plugin can fetch a preview registered user defined data type FetchStructure as function (THIS_REGISTRY, _ nam as zstring ptr, _ vMajor as integer , _ vMinor as integer) as integer
|
|
|
Post by Darkjester on Jan 14, 2009 16:16:17 GMT -5
RT = register type not return type ;-) Its a newb mistake with the sdk Odama  lolz Get on IM odama we need to talk.. -Darkjester
|
|
|
Post by Adam on Jan 14, 2009 16:31:29 GMT -5
lol... sorry about that.. i am confusing myself.. found it but still getting some errors =[ (STV(t,v))
or am i even doing this right?
I am trying to return a pointer to a library type
|
|
|
Post by Darkjester on Jan 14, 2009 16:41:44 GMT -5
why are you trying to return a pointer to a library type? this helps when you show us what your trying to do
|
|
|
Post by DJLinux on Jan 14, 2009 16:46:09 GMT -5
if you return a type B4GL will read the type from the DLL memory so you must return the address of the type
your_type.member=123
STR(handle,@your_type) ' @ will return the address of your_type
|
|
|
Post by Adam on Jan 14, 2009 16:49:15 GMT -5
i am trying to do something equivalent to "World=NewtonCreate()" from djlinux's plugin or "handle = newSprite()" if that makes sense?
|
|
|
Post by Darkjester on Jan 14, 2009 16:49:41 GMT -5
meaning he can use types defined in other librarys? such as GTK+?
|
|
|
Post by DJLinux on Jan 14, 2009 16:54:18 GMT -5
i am trying to do something equivalent to "World=NewtonCreate()" from djlinux's plugin or "handle = newSprite()" if that makes sense? if world or handle are integers then use SIR(world) or SIR(handle) SIR(value) means et nteger [r]esult
SFR(value) means et [f]loat [r]esult
STR(handle,@type] means et [t]ype [r]esult
|
|
|
Post by Darkjester on Jan 14, 2009 16:55:57 GMT -5
What kind of types can you return? are their restrictions? im asking these in terms of c++...
|
|
|
Post by DJLinux on Jan 14, 2009 16:56:12 GMT -5
meaning he can use types defined in other librarys? such as GTK+? sure you can use any type in your plugin code but for B4GL you must register any type before you can use it Joshy
|
|
|
Post by Adam on Jan 14, 2009 16:58:45 GMT -5
so far this is what i have for the function
private sub GtkWindowNew(THIS_RUNTIME) Dim As GtkWidget Ptr Win = Gtk_Window_New(Gtk_Window_TOPLEVEL) STV(0,@Win) end sub
and i am getting an error with registering it
RTF(GtkWindowNew,@GtkWindowNew,gtkWidget)
and this is how i am registering the type, i don't know if i am doing it right or if i even should do it at all
RTBPF(GtkWidget)
|
|
|
Post by DJLinux on Jan 14, 2009 17:05:16 GMT -5
"dim as GtkWidget Ptr win" is a pointer and a pointer is in basic4gl simple an 32bit integer ' use this SIR(win)
and RIF(GtkWindowNew,@gtkwindownew)
or do you have registered the whole GtkWidget as TYPE?
|
|
|
Post by Adam on Jan 14, 2009 17:06:02 GMT -5
so if i return the address when i hand it back to the plugin with a different function could i use it just like i would the pointer?
|
|
|
Post by DJLinux on Jan 14, 2009 17:10:16 GMT -5
by the way, it's a nice idea to use GTK in B4GL but it won't work the gtk "messageloop" will block B4GL or how you would get the gtk window messages?
i mean after "gtk_main( )" your plugin will block B4GL
Joshy sorry if i'm wrong
|
|