Posts: 922
Threads: 15
Joined: Jun 2003
Why using ASM? Declare it as a function pointer.. you can do
Code:
type myfuncptr as sub(byval as string, byval as string, byval as string)
dim as myfuncptr f1, f2, f3, ...
f1("a", "b", "c")
with 0.13 (and w/o the typedef w/ 0.12 and below), no temp strings needed or whatever.
Posts: 489
Threads: 34
Joined: Jan 2005
i got an error trying that... something about no forward function pointers. :???:
fsw: to make it do that, catch the close event (wxEvent_EVT_CLOSE_WINDOW), and in the handler sub, if you don't want the window to close, do a wxEvent_Skip of the event. :wink:
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 489
Threads: 34
Joined: Jan 2005
er, here's the exact error (and code)
Code:
dim shared FunctionPtr as function ptr
Code:
C:\fb>fbc fbiide.bas
fptest.bas(1) : error 67: Forward references not allowed, found: 'ptr'
dim shared FunctionPtr as function ptr
^
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 922
Threads: 15
Joined: Jun 2003
The problem is that id you use FUNCTION to declare the pointer, then you need the explicity return type as it can't be guessed (function pointers have no names), so use SUB instead.
If you do "foo as SUB" or "foo as FUNCTION as sometype", foo is already a pointer, don't add "ptr" after it, or it will be a pointer to a pointer and things get nasty..
Posts: 251
Threads: 22
Joined: Dec 2004
Quote:Why using ASM? Declare it as a function pointer.. you can do
Code:
type myfuncptr as sub(byval as string, byval as string, byval as string)
dim as myfuncptr f1, f2, f3, ...
f1("a", "b", "c")
with 0.13 (and w/o the typedef w/ 0.12 and below), no temp strings needed or whatever.
This is strange...
It works :o
FreeBasic is an excellent compiler
Posts: 922
Threads: 15
Joined: Jun 2003
Hmm, 2 error messages were missing, so the "Forward references..." msg was shown, it should be "Expected explicit result type".
Posts: 489
Threads: 34
Joined: Jan 2005
i tried to get it to work under linux, but am having some problems.
i think that in order to compile right it needs the flag "-lwx-c" but fb is passing "-llibwx-c"... any way around this?
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 922
Threads: 15
Joined: Jun 2003
Change the header to:
#ifdef FB__WIN32
#inclib "libwc-x"
#else
#inclib "wc-x"
#endif
Posts: 489
Threads: 34
Joined: Jan 2005
still having big problems... i get a lot of strange errors from the wx-c lib... here's just a few:
Quote:/usr/lib/libwx-c.so: undefined reference to `_ZNK14wxBitmapButton8GetLabelEv@WXU_2.5'
/usr/lib/libwx-c.so: undefined reference to `wxEVT_COMMAND_RADIOBOX_SELECTED@WXU_2.5'
/usr/lib/libwx-c.so: undefined reference to `wxEVT_SCROLL_THUMBRELEASE@WXU_2.5'
/usr/lib/libwx-c.so: undefined reference to `_ZN12wxEvtHandler9TryParentER7wxEvent@WXU_2.5'
/usr/lib/libwx-c.so: undefined reference to `_ZN10wxComboBox8DoInsertERK8wxStringi@WXU_2.5'
/usr/lib/libwx-c.so: undefined reference to `_ZNK7wxEvent12GetTimestampEv@WXU_2.5'
there's at least 1000 of these
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 489
Threads: 34
Joined: Jan 2005
oops, guess i need to #inclib "wx_gtk-2.5" too...
unfortunately, i get
Quote:godzilla FreeBASIC # emerge wxGTK-2.5
Calculating dependencies
!!! Problem in x11-libs/wxGTK-2.5 dependencies.
!!! "Specific key requires an operator (x11-libs/wxGTK-2.5) (try adding an '=')" exceptions
when trying to install it under gentoo...
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear