View Full Version : what are the counter part of "thinBasic_ReturnCodeSingle"
D.J.Peters
08-03-2010, 14:12
i mean if i can return a float/single data type
where are "thinBasic_ParseSingle" ?
and why are the C interface have only rudimentary function ?
looks like the BASIC SDK's have the whole thinBasic interface implemented.
i can add missing thinks to the C/C++ headers
but than the MSC xxx.lib and GCC libxxx.a files
are out of date
of course i can use FreeBASIC too
but if you have C++ classes
you must make a wrapper for FreeBasic
and than you can write a TBXX module with FreeBASIC
but the result would be 2 *.dlls
From C/C++ you can write a thinBasic module
without a second wrapper lib.
how to handle the EXT number data type ?
and last but not least
i can't see any rule when params must inside of "(" ")"
for example TBGL_Vector 1,2,3 ' no "()" are needed
but TBGL_SetWindowTitle(hWnd,"Title") needs "()"
"normaly" SINGLE is the most used floting point dadata type
it has a big range of numbers and needs only 4 bytes
i don't see the sence to use 8 bytes double or the bigger EXT format
from a interpreted language
sorry for all my questions but i'm new with thinBasic
and it's currently a liltle bit confuse for me
thanx for your help
Joshy
Petr Schreiber
08-03-2010, 15:56
Eros will give you more complete reply,
but here few sinsights:
- C/C++ interface is behind others, as no one used it here. I think most modules are developed in PowerBASIC currently.
- rule to determine which commands must have "()" and which not is completely up to programmer. When you use interface function like thinBasic_Parse2Numbers ... I think it allows both Command 1, 2 and Command(1, 2). It seems the tendention in last time is to prefer the "()" syntax.
- instead of using the simple thinBasic_ParseNNumbers function, you can take full control of the parser, where you can force the "()" like:
IF thinBasic_CheckOpenParens_Mandatory() THEN
thinBasic_ParseNumber x
IF thinBasic_CheckComma_Mandatory() THEN
thinBasic_ParseNumber y
IF thinBasic_CheckCloseParens_Mandatory() THEN
' do something here
END IF
END IF
END IF
With this "sequential" parsing you can create interesting multi syntax commands, which decide what to parse on the fly.
- EXT data type is 80bit precision floating point. I think in C/C++ it is nicknamed "long double", but not sure.
Escaping back to school,
Petr
ErosOlmi
08-03-2010, 16:36
I will reply widely later when back home this evening.
In any case, as said before, thinBasic SDK for C/C++ has just very few of the interface function available. Since the beginning there was no interest on it other than few users. In the mean time there was a bigger interest in Power Basic and Free Basic.
As already said (again) I'm not in the position to develop C/C++ further in short time period because I'm not a C programmer. Maybe I can handover it but I have to check, so I cannot promise anything now, sorry.
Regarding why EXT data type, EXT is the native FPU data type and the fastest.
Eros
Michael Hartlef
08-03-2010, 17:41
Hi joshi,
as i dont want to use PowerBasic for my future modules anymore, i need a current c sdk too. Next week i have more time in the evenings and so have plans to work on a new include file.
Michael
Michael Hartlef
18-03-2010, 23:52
Hi joshi,
as i dont want to use PowerBasic for my future modules anymore, i need a current c sdk too. Next week i have more time in the evenings and so have plans to work on a new include file.
Michael
Hi Joshi,
so far not much to show. I was able to create a new import lib from the newest thincore.dll but somehow MinGW doesn't like it really because as soon I add a second command to the LoadSymbols section, ThinBasic gives a GPF when I run the script. The same C++ code works with the old import files. :(
Any idea what it could be?
Michael
D.J.Peters
19-03-2010, 00:52
hello Michael
here are how i would create a new import lib
makelib.bat
pexports .\thinCore.dll > .\thinCore.def
dlltool -k -d .\thinCore.def -l .\libthinCore.dll.a
pause
you can try the import lib libthinCore.dll.a from zip file
Joshy
Michael Hartlef
19-03-2010, 01:09
No, no go. Can't even link with it. Thanks anyway.
D.J.Peters
19-03-2010, 02:08
No, no go. Can't even link with it. Thanks anyway.
why not ?
I'm a VisualStudio Pro user and use *.lib not *.dll.a files.
please post the error message.
sorry wihtout it i can't help you
Joshy
D.J.Peters
19-03-2010, 02:25
please try this import lib and let me know wehats going on
Michael Hartlef
19-03-2010, 07:23
No, no go. Can't even link with it. Thanks anyway.
why not ?
I'm a VisualStudio Pro user and use *.lib not *.dll.a files.
please post the error message.
sorry wihtout it i can't help you
Joshy
Hi Joshi,
I am using Mingw with Code:Blocks. Here is the error list:
-------------- Build: Release in thinBasic ---------------
Linking dynamic library: bin\Release\thinBasic_myC.dll
Info: resolving _thinBasic_LoadSymbol by linking to __imp__thinBasic_LoadSymbol (auto-import)
Info: resolving _thinBasic_CheckCloseParens by linking to __imp__thinBasic_CheckCloseParens (auto-import)
Info: resolving _thinBasic_ParseString by linking to __imp__thinBasic_ParseString (auto-import)
Info: resolving _thinBasic_CheckOpenParens by linking to __imp__thinBasic_CheckOpenParens (auto-import)
Creating library file: bin\Release\libthinBasic_myC.a
C:\Programme\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
fu000001.o:(.idata$2+0xc): undefined reference to `__libthinCore_dll_a_iname'
fu000003.o:(.idata$2+0xc): undefined reference to `__libthinCore_dll_a_iname'
fu000004.o:(.idata$2+0xc): undefined reference to `__libthinCore_dll_a_iname'
fu000006.o:(.idata$2+0xc): undefined reference to `__libthinCore_dll_a_iname'
fu000007.o:(.idata$2+0xc): undefined reference to `__libthinCore_dll_a_iname'
fu000009.o:(.idata$2+0xc): more undefined references to `__libthinCore_dll_a_iname' follow
nmth000000.o:(.idata$4+0x0): undefined reference to `_nm__thinBasic_LoadSymbol'
nmth000002.o:(.idata$4+0x0): undefined reference to `_nm__thinBasic_CheckCloseParens'
nmth000005.o:(.idata$4+0x0): undefined reference to `_nm__thinBasic_ParseString'
nmth000008.o:(.idata$4+0x0): undefined reference to `_nm__thinBasic_CheckOpenParens'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
9 errors, 1 warnings
Michael Hartlef
19-03-2010, 07:26
please try this import lib and let me know wehats going on
Thanks, here I get no linking errors, but the same result like with the import lib I created myself. As soon I add a second function to loadsymbols, the script gives a GPF.
Michael Hartlef
19-03-2010, 12:48
Dooo, I hope that this is my solution. I read that Freebasic uses the GNU linker as well to talk to import libs.
I think the FreeBasic SDK should have a recent one then too. As soon as I have access to my computer tonight,
I will look there for the input library. An old SDK here in the forum had one. So there is hope. Once I get this working, I will start translating the current thincore.inc file to C.
D.J.Peters
20-03-2010, 05:47
Hallo Michael
the last libthinBasic.dll.a i created and posted works without any problems.
you must tell the linker not use name decorations @xx
if you can't use this option
here the steps how you build your own fresh *.dll.a file for MinGW
step 1 use pexports and create an *.def file from thinCore.dll
pexports .\thinCore.dll > .\thinCore.def
step 2 open thinCore.def with any text editor and replace all " DATA" with "" (nothing)
step 3 use dlltool and create libthinBasic.dll.a from thinBasic.def file
dlltool -d .\thinCore.def -l .\libthinCore.dll.a
Joshy
Michael Hartlef
20-03-2010, 12:39
Hi Joshi,
did all that. Maybe I am to stupid, I don't know. :oops:
I used your lib. A thinBasic script crashes when I add a second command or if I just put one command in,
i get an unknown keyword in thinbasic. So something is wrong on my site here. I guess I give up as this is way to complicated
to get running. Also I had rebuild the lib just like you told me. Same results.
Thanks for your help anyway, I appreciate that.
Cu
Michael