PDA

View Full Version : thinBasic interface under Microsoft visual C/C++ language



RobertoBianchi
25-11-2005, 14:21
thinBasic allows C/C++ programmers to develop their own thinBasic modules. Modules are special dll that are loaded dynamically by thinBasic engine during scripts execution. Modules can be used to implement new thinBasic functionalities adding new keywords to the language or interfacing external programs.
We provide static thinC.lib and dinamic thinC.DLL plus thinC.lib for linkage purpose, so MS Visual C/C++ programmers could choose to use external interface .DLL or embed it into their own thinBasic Modules.

Plase find here attached interface file with a simple module example, for Microsoft C++ compiler.

Feel free to ask here in case of any question on module development.

Regards
Roberto

kryton9
05-12-2006, 00:22
The zip file says the file is not located on this server.

I can't believe I never looked in these section of the forums, I am trying out the various sdk's to see if I can use any of them.
I know I posted many questions that could have been answered by looking here and doing some research, sorry about that.

ErosOlmi
05-12-2006, 00:56
Hi Kryton9.

You can find all interface SDK under \thinBasic\SDK directory after thinBasic installation. Those are always the up to dated files.
Roberto will delete the file originally attached to this post.

Thanks
Eros

kryton9
05-12-2006, 01:59
Oh OK, thanks Eros, will check those out then :)

kryton9
05-12-2006, 04:19
Well, I tinkered with all the C type SKD elements, my report:

MSC++: Using VS C++ express, I had no luck. I keep getting all sorts of errors. I configured the paths to the directories, I even put the SDK folder on the root of drive C, I noticed that in Borland the file paths were getting too long for it to use.

Borland C++, I thought I had C++ 5, but I just had C++ builder from 1997. Anyways once I got the path situation figued out, I couldn't get it to compile a dll either with all sorts of errors.

Dev-C++: Success, I got this one to work. Maybe it says something about DevC++ compared to the others.

Maybe you guys can make a video using VSC++ express and show how you can compile the sample DLL from the SDK, the same for all the SKD units, it would be informative.

I was going to record my attempts, but figured they would be long videos and didn't want to do them unless you guys wanted them.

I will tinker with Dev-C++ tonight since it was the only one to work for me :)

RobertoBianchi
05-12-2006, 10:41
Hi Kriton,

sorry I'm not able to do a video (I do not have your director abilities), but if you give me the details of MSC++ errors I can help you.

Ciao,Roberto

Petr Schreiber
05-12-2006, 20:22
Hi kryton,

I can confirm it works using BCC 5.5, thanks to Roberto's advices before many months :)
Also check out MASM SDK :)

Bye,
Petr

kryton9
05-12-2006, 22:13
Maybe my version of Borland C++ is too old to get it working. I thought it was version 5 but it is not.

I will make a video showing me trying to make the dll within MS C++ express, I will try to be quick so the video is not too long.
Hopefully we can catch what I am doing wrong. Thanks for the responses guys.

kryton9
06-12-2006, 02:33
Ok, I recorded a video today trying to use the SDK in MS C++. I decided not to post it as it is long about 26 mbs. But I noticed somethings I didn't yesterday.

1. I got a message that in MS C++ Express, you can't edit dll files. There is no option to make or build them either. I was just pressing the green run button yesterday.

When I did that I got the error I got yesterday:
Compiling...
thinBasic_myC.c
Compiling resources...
Linking...
LINK : fatal error LNK1181: cannot open input file '\thinBasic\Lib\thinBasic_myC\MS-C++\thincore.lib'

The problem is my SDK is in the root C directory, and I set up my directories to look in C:\SDK\thinBasic C SDK\MS-C++\Lib\ folder not in the thinBasic folder. So it must be reading this information from one of the files, but I couldn't find which one.

But it doesn't matter as the express version does not allow dll creation it seems.

Does Ebasic work to make dll's for thinBasic. If it works, I could always use that as I have iBasic Standard and can make the change over to Ebasic probably pretty easilly. I am not sure if FreeBasic allows dll creation. I did download it and start to play with it.
I am having problems getting dll's to download that match the library versions freebasic supports and I don't enough about the whole process yet to figure out how to adjust.

So I will work with Turbo Delphi and of course, the new C# and XNA videos from 3dBuzz might swing me over to c#, I did like it too and XNA with all the libraries are there to do almost anything. I will definitly watch those when they come out. It will be nice to settle on a compiled language and really learn it like I am doing with thinBasic as my scripting language.

RobertoBianchi
06-12-2006, 10:24
Hi Kryton9,

to solve the compilation problem with MS VC++ please do the following steps:


Open Microsoft Visual C++
From Menu FILE choose OPEN WORKSPACE and open the thinBasic_myC workspace/li]
From Menu PROJECT choose SETTINGS
Chose settings for: ALL CONFIGURATIONS
Click on LINK TAB
Look at OBJECT/LIBRARY MODULES and find the THINCORE.LIB then change the path according your SDK path

Ciao,
Roberto

kryton9
06-12-2006, 22:35
Thanks Roberto, I have MS C++ Express and there is no such choice under FILE OPEN WORKSPACE.
And it seems Express will not let you open files for dll's or to make them.

I will wait for the Delphi patch to come out, or if C# looks good after I watch some videos I might swith to that.
I just can't warm up to C and C++, I have tried for many years, I did play with Turbo C in the early 1990's and it was fun reading
the Borland Books and Herbert Schildt's C programming Books, but after that it was just too much code to write to do things that were so much easier in other languages.

Eros told me about FreeBasic and I remember Parker at Coding Monkeys had pointed out that language too, it is supposed to have OOP and is Basic, so that might be something to look at too. I just got it this week and will play with it. Will be interesting to see if I can make DLL's with that. Nice to have options again in programming.

kryton9
30-01-2007, 08:51
Roberto, I installed MS visual studio 2005 and couldn't get it to compile. The directions you gave me earlier and my results are exactly the same as my attempts with the express version.

I will attach screenshots of my menus so you can see that they are different. I couldn't find corresponding things according to your instructions. Any ideas?

RobertoBianchi
30-01-2007, 10:20
Hi Kryton9,

I'll chek ASAP, but only with MS Visual Studio 2005 Express.

Ciao,
Roberto

kryton9
30-01-2007, 11:03
The menus are the same as that is what I was trying with before and wanted to see if vs 2005 not express had the workspace in the file menu, but it didn't.

It will be neat to get it working with express as it is widely available and being promoted so well on microsoft's site.

Good luck, let me know how it goes, will be glad to try it out on both!!

RobertoBianchi
30-01-2007, 15:13
Hi Kryton9,

I've splitted the SDK for MS Visual C++ into two child board, one (the old, these one) for MSVS 6.0 and the new for MSVC .NET.
Actually the MS .NET compiler tested is the 2002 but I'll try some test with 2005.

If you want, please check also the MSVC 6.0 (sticky topic) because I updated also that SDK.

Ciao,
Roberto

kryton9
30-01-2007, 23:31
Thanks Roberto, with the new download from the first post, it worked. It also asked for thinC.dll, so I copied it to the folder along with the generated thinBasic_myC.dll and it worked!!

Will I need to include that thinC.dll in all cases in the future?

RobertoBianchi
31-01-2007, 10:15
Kryto9,

using MSVS++ 6.00 SDK you have two choiche, Dynamic or Static.
Dinamic or static is referred to how the THINC code is used from the c module that you are making.
If you choose Dynamic, you must always include an provides the THINC.DLL with your ThinBasic module (aka .dll).
Instead if you select the static project, the THINC.lib will be linked to your module, so no needed to include and provide the THINC.DLL.

Please note that the Dynamic or Static choiche is available only with MSVS++ 6.00 SDK.

Regards,
Roberto

kryton9
31-01-2007, 10:29
Thanks Roberto. It felt good to get good compiles with both. After I get into Delphi, I plan on learning C++ in earnest. I have been putting it off all of these years, when I know I should learn it, everything points to it it seems. But as I look into Delphi, it is popular and they are just a step behind in getting libraries into Delphi and OpenPascal.

I hope once I learn either, both of those languages I can contribute with nice modules in the future.

RobertoBianchi
31-01-2007, 13:01
Kryton9,

your modules are welcome!
I wish you good study and work.

Ciao,
Roberto

kryton9
17-06-2007, 06:12
Roberto, which c++ do you use daily? Do you run into aggravating problems getting your programs to run on different hardware or have you found a good balance in development environment and systems you write for?

Do you ever write stuff for linux also?

Just curious as I have gotten pretty confused with my c++ studies. Doing console apps, some simple opengl stuff, ok, easy enough to do, but when you try to bring in major third party libraries, then try to make it all work... it is a big mess. And compared to thinBasic, Delphi, Aurora, ibasic, just so much more code to write to do the same thing. The whole idea of reuseability seems to get lost with all the xtra work needed to be done. Maybe I am missing something in my learning, so just wanted to hear from someone who was happy using it. That is if you are that is :)

RobertoBianchi
18-06-2007, 08:48
Kryton,

actually I use both MS Visual C++ and GCC, and until now I didn't found problems running on different hardware platform but until now I didn't write program to use specific hardware.
In the past I used heavy the Borland Turbo C.

Never written programs for linux but only console programs on UNIX System V.

Ciao,
Roberto

kryton9
18-06-2007, 23:02
I guess I am wanting that one perfect combination to do it all and it doesn't exist, except for maybe Java. But I am not ready to give up yet.
Delphi is really close to being that all perfect combo. But the challenge of c++ is there and I hate walking away from challenges, so I will struggle with it some more.

RobertoBianchi
14-09-2007, 13:04
Updated today.

See http://community.thinbasic.com/index.php?topic=1193.msg8264#msg8264 for details.

Roberto.

D.J.Peters
05-03-2010, 15:48
seams to be the function decoration in current MSC SDK is wrong.

the precompiled MSC example DLL export his entrys with an underscores
but thinBasic modules does not have an underscore in front of the exported names.

Joshy

ErosOlmi
05-03-2010, 16:29
To keep Core engine compatible with PowerBasic/FreeBasic and C at the same time, some functions have "_" in front of the interface name.
Those with "_" in front of the name are specific for C.

D.J.Peters
05-03-2010, 17:04
hello Eros
i know but will thinBasic look for both declares ?

all thinBasic lib's dosn't have an undersore but
the example shipped with the MSVC SDK have one.

Joshy

ErosOlmi
05-03-2010, 17:10
Yes.

thinBasic first check if module exports "LoadLocalSymbols"
If found, it is marked an "*Basic"

If not found, thinBasic checks for "_LoadLocalSymbols"
If found, module is marked as "C"

On module unload, "UnLoadLocalSymbols" or "_UnLoadLocalSymbols" is automatically invoked depending on what was found during load.

Whenever possible I've always tried to automate interfaces in order to leave very few to the users.
To add a new module it is just needed to put into \Lib\ directory and use it in script without any worry about library and fall into the so called "dll hell"

Ciao
Eros