Bald middle-aged man joins the club...

For other topics related to the FreeBASIC project or its community.
caseih
Posts: 1354
Joined: Feb 26, 2007 5:32

Re: Bald middle-aged man joins the club...

Postby caseih » Jan 17, 2015 22:48

The real problem with accessing any C++ library from any other language is you have to write a shim that instantiates and manages the C++ objects (using C++ code), and provides a bunch of C methods for interacting with those instantiated objects. Indeed any time you are trying to interface between two different object systems you need a bridge. That takes a fair amount of manual coding, or a lot of code generation. Which means we won't see good bindings for Qt for some time, but we have good GTK bindings right now, even if they are 1:1 C bindings, and do not wrap gobjects with FB objects, which would be wonderful.

I don't see the lack of a BOOL type as a problem for wrapping C++ libraries. I don't see how FB can have a BOOL type anyway, since as near as I can tell, BASIC does not have logical operators to manipulate BOOLs. FB would have to add them, which can be done, but adds a more ambiguity to the grammar, or else add new keywords (in C & vs && for example).
D.J.Peters
Posts: 7714
Joined: May 28, 2005 3:28

Re: Bald middle-aged man joins the club...

Postby D.J.Peters » Jan 17, 2015 23:33

@caseih you can use C++ classes (build with GNU g++) from libs directly in FreeBASIC without a hand written wrapper extern "C++" is the key.
But if a class has an "bool" parmeter or return value the name mangling will fail and the linker can't solve the open references.

As a test I replaces all "bool" in Irrlicht Engine with "int" and after recompile of Irrlicht you can use it with FreeBASIC.

Except classes with inheritance for multiple interfaces must be rewritten.

You know ?

Joshy
caseih
Posts: 1354
Joined: Feb 26, 2007 5:32

Re: Bald middle-aged man joins the club...

Postby caseih » Jan 18, 2015 1:43

Interesting. I didn't know that. Very cool.

Sorry to the OP for taking this so far off course!
D.J.Peters
Posts: 7714
Joined: May 28, 2005 3:28

Re: Bald middle-aged man joins the club...

Postby D.J.Peters » Jan 18, 2015 11:23

caseih wrote:I didn't know that.
some simple g++ tests are in "FreeBASIC\examples\other-languages\C++"

Joshy
Lord Baldy
Posts: 4
Joined: Jan 15, 2015 17:42
Location: Newton Abbot, Devon

Re: Bald middle-aged man joins the club...

Postby Lord Baldy » Jan 18, 2015 11:48

Thanks for the various welcome's!

I'm also glad to have come in useful for being the conduit for an in depth, well argued and incomprehensible (to me) discussion!

Been reading up on the various technical gubbings and whatnot's, and have started planning my first project (I like planning), which I hope will turn out to be in the immortal words of Baldrick my magnificent octopus...
dodicat
Posts: 5828
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Bald middle-aged man joins the club...

Postby dodicat » Jan 18, 2015 13:42

Now that you have your feet under the table, what do we call you?
m'lud or plain old Baldy.
Or is it Rodney perhaps, as per the trotters?
Lord Baldy
Posts: 4
Joined: Jan 15, 2015 17:42
Location: Newton Abbot, Devon

Re: Bald middle-aged man joins the club...

Postby Lord Baldy » Jan 18, 2015 14:26

dodicat wrote:Now that you have your feet under the table, what do we call you?
m'lud or plain old Baldy.
Or is it Rodney perhaps, as per the trotters?


I like to keep things informal so Baldy will suffice, unless I'm wearing my blonde wig and high heels in which case it's Deborah...
Dr_D
Posts: 2376
Joined: May 27, 2005 4:59
Contact:

Re: Bald middle-aged man joins the club...

Postby Dr_D » Jan 18, 2015 17:54

Lord Baldy wrote:
dodicat wrote:Now that you have your feet under the table, what do we call you?
m'lud or plain old Baldy.
Or is it Rodney perhaps, as per the trotters?


I like to keep things informal so Baldy will suffice, unless I'm wearing my blonde wig and high heels in which case it's Deborah...


You'll fit in here just fine. lol ;)
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Re: Bald middle-aged man joins the club...

Postby 1000101 » Jan 18, 2015 19:37

Porn? Cross-dressing? How to deal with import libs in languages using a different object systems? This thread has everything!

Welcome to the forum Deborah!
BasicCoder2
Posts: 3359
Joined: Jan 01, 2009 7:03

Re: Bald middle-aged man joins the club...

Postby BasicCoder2 » Jan 18, 2015 20:54

Lord Baldy wrote:... after spending quite a while trying to decide what language i'd attempt to learn, ended up here after using the logic that as it's a form of basic i may find it a bit easier than some of the more modern stuff.

Some of the "modern stuff" is easier than FreeBasic for particular tasks and I suspect professional programmers (those who write commercial code and get paid) are multilingual and up to speed on the main ones.
Ruby, Python, PHP, Objective-C, HTML, CSS, JavaScript, Java, .Net, C/C++.
I have no idea why others here spend time with FreeBASIC.
For me as a casual do it for fun hobby programmer FreeBasic is a powerful update on QBasic which I used to use.
Essentially I am still living in the past :)

... probably will crash and burn ...

You either have a passion for programming or you don't.
Your posts have entertainment value perhaps you should become a writer?
Pritchard
Posts: 5492
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Re: Bald middle-aged man joins the club...

Postby Pritchard » Jan 19, 2015 2:30

1000101 wrote:Porn? Cross-dressing? How to deal with import libs in languages using a different object systems? This thread has everything!

Welcome to the forum Deborah!

Pics already? Player player!

How's the wig?
caseih
Posts: 1354
Joined: Feb 26, 2007 5:32

Re: Bald middle-aged man joins the club...

Postby caseih » Jan 19, 2015 4:30

I spend time here on the forum for nostalgia reasons I suppose. BASIC is what I learned when I was very young, and later on I did a lot of programming in Turbo, Quick, and Power BASIC. For years I wished there was a good structured BASIC on Linux. We pestered Bob Zale for a long time about PowerBASIC on Linux and he always said, some day, some day. Sadly PB never really got much beyond 16-bit windows (the compiler could emit 32-bit code, but the computer itself was always 16-bit assembly, if I understand correctly).

When I discovered FreeBASIC, it was almost too late as I had moved on to other languages. But I've had fun porting old projects to run on Linux, and overall I'm quite impressed with FreeBASIC and the progress that's been made. And this community, though somewhat small, is fairly vibrant, and many folks contribute regularly library bindings to make FB useful. Certainly FreeBASIC makes a very capable C replacement for many tasks (being directly ABI-compatible), and to a lesser degree a replacement for C++ as it develops good OOP capabilities.

That said, I do virtually all my programming in Python these days. For a semi-interpreted language, Python is fast enough, but for me it really hit the sweet spot of capability, flexibility, and expressivity (is that even a word?!). If I could generate libpython bindings for FreeBASIC, that would be very nice. FreeBASIC might be a good fit for writing Python extensions.
BasicCoder2
Posts: 3359
Joined: Jan 01, 2009 7:03

Re: Bald middle-aged man joins the club...

Postby BasicCoder2 » Jan 19, 2015 4:42

caseih wrote:... I do virtually all my programming in Python these days. For a semi-interpreted language, Python is fast enough, but for me it really hit the sweet spot of capability, flexibility, and expressivity (is that even a word?!).

Expressivity:
: the relative capacity of a gene to affect the phenotype of the organism of which it is a part
: the quality of being expressive

Do you use Python for anything commercial? I started learning Python as it was the language of choice for some hardware projects I was interested in but it is a strange language compared with BASIC.

I thought if I ever got an Android tablet or phone I could learn Basic4Android (translates to Java) but first step is coming up with an app worth coding. It was pointed out in a magazine that the reason you hear about people making a fortune out of an app is because it happens so seldom.
caseih
Posts: 1354
Joined: Feb 26, 2007 5:32

Re: Bald middle-aged man joins the club...

Postby caseih » Jan 19, 2015 5:25

I personally don't use Python for anything that is commercially released, but I certainly use it internally at my business for scripting, report generation, etc. I also used it extensively at the last place I worked. Python drove large parts of our web infrastructure, and python scripts were used extensively by our admins.

Now, Python is not a compiler so if you want to release a self-contained program, you have to bundle it up with Python somehow, either with something like py2exe, or by just bundling the whole runtime and have a starter program that fires up python with your main script, kind of like how java-based programs are often distributed. So it's not always a first choice for a commercial software package, nor is it always appropriate.

I can understand Python being a bit weird to you. Whitespace syntax sounds awful, but it's really amazing once you get used to it. Python code is really executable pseudocode. I think another power feature of Python is borrowed from LISP. The idea of lists being first-class data structures. Such a powerful concept. I think I mentioned this but personally I'm twice as fast at programming in Python than any other language I know, and my error rate seems to be lower.

Anyway, I think for many folks on this list, FreeBASIC hits the sweet spot, so if it works for you, that's wonderful! Keep on programming. It's fun. But always keep an open mind. Dynamic languages are very powerful.
Pritchard
Posts: 5492
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Re: Bald middle-aged man joins the club...

Postby Pritchard » Jan 20, 2015 20:42

Interestly, a Google search for "bool C++ mangling" gave FreeBASIC as the second link.

What is the issue with bool's, anyways?

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest