Pre-purchasing question on string handling
Pre-purchasing question on string handling
Hi all.
Before purchasing PureBasic I need a confirmation about how string are internally handled by PureBasic.
I need to convert some big code from Power Basic. This code make great use of Win32 OLE string engine, the equivalent BSTR in mSDN documentation: http://msdn2.microsoft.com/en-us/library/ms221069.aspx
So my question is: are PureBasic strings Win32 OLE strings? If not, how they are organized in memory?
Maybe there is already an aswer here in the forum, so please excuse me for asking directly.
Thanks a lot
Eros
Before purchasing PureBasic I need a confirmation about how string are internally handled by PureBasic.
I need to convert some big code from Power Basic. This code make great use of Win32 OLE string engine, the equivalent BSTR in mSDN documentation: http://msdn2.microsoft.com/en-us/library/ms221069.aspx
So my question is: are PureBasic strings Win32 OLE strings? If not, how they are organized in memory?
Maybe there is already an aswer here in the forum, so please excuse me for asking directly.
Thanks a lot
Eros
Hi,
Purebasic uses null terminated strings (anis and unicode) which interface perfectly with most of the win api. bstr type strings can be utilised when calling external libraries through what are called pseudo-types. For other work with bstr strings, converting to and from null terminated strings is easy enough, no problem at all.
Purebasic uses null terminated strings (anis and unicode) which interface perfectly with most of the win api. bstr type strings can be utilised when calling external libraries through what are called pseudo-types. For other work with bstr strings, converting to and from null terminated strings is easy enough, no problem at all.
I may look like a mule, but I'm not a complete ass.
So PureBasic strings are pointers to a null terminated sequence of bytes (or double bytes). To store bynary data (containing null bytes) in PB, I need to manage alloc/free by manual (heap allocation) or use the native OLE32 SysAllocXXX functions.
Ok, thanks a lot. That is what I needed to know. I will make some tests using PureBasic demo download and see where I can go.
Eros
Ok, thanks a lot. That is what I needed to know. I will make some tests using PureBasic demo download and see where I can go.
Eros
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Ok, thanks. In any case I've already get the idea where to go regarding strings.
I will go through the help file and forum to get the rest of items I'm interested for my translation.
Ciao
Eros
I will go through the help file and forum to get the rest of items I'm interested for my translation.
Ciao
Eros
Last edited by erosolmi on Wed Aug 08, 2007 9:04 pm, edited 1 time in total.
I've seen PureBasic is a great language but not suitable to my project due to licence limitation in wrapping PureBasic internal functionalities. I can understand that.
My project consists to porting my interpreter from PowerBasic to PureBasic. This will imply to wrap many internal compiler functions plus porting interpreter external modules that, again, contain some possible wrappers. But this is not allowed by PureBasic licence. And this is perfectly reasonable.
Maybe I will in any case consider purchasing PureBasic for my company internal development.
OK gui. Thanks for your reply.
Ciao
Eros
My project consists to porting my interpreter from PowerBasic to PureBasic. This will imply to wrap many internal compiler functions plus porting interpreter external modules that, again, contain some possible wrappers. But this is not allowed by PureBasic licence. And this is perfectly reasonable.
Maybe I will in any case consider purchasing PureBasic for my company internal development.
OK gui. Thanks for your reply.
Ciao
Eros
Last edited by erosolmi on Wed Aug 08, 2007 11:44 pm, edited 1 time in total.
Hey Eros,
Another familiar name from the Powerbasic Forum, there's quite a lot of us over here.
Powerbasic users tend to go via this thread to detox
helps them get acclimatised.
http://www.purebasic.fr/english/viewtopic.php?t=26247
There's a good PDF book (or printed) that you can buy fairly cheaply that can give you a good running start. If you look at my profile and find some of my posts on strings etc you will see a lot of things that will help you.
Strings are a big deal to people coming from powerB and they don't work the same. There are different ways of doing things, generally in PureB you don't use strings as generic data containers.
Let me know if you have any specific powerB -> PureB questions, I'm pretty much up and running with all this now, it took a little while to get used to the syntax changes but it was worth the effort.
There's plenty of PowerB people here asking similar sorts of questings, Elias was asking about "Dim AT" the other month for example.
Another familiar name from the Powerbasic Forum, there's quite a lot of us over here.
Powerbasic users tend to go via this thread to detox

http://www.purebasic.fr/english/viewtopic.php?t=26247
There's a good PDF book (or printed) that you can buy fairly cheaply that can give you a good running start. If you look at my profile and find some of my posts on strings etc you will see a lot of things that will help you.
Strings are a big deal to people coming from powerB and they don't work the same. There are different ways of doing things, generally in PureB you don't use strings as generic data containers.
Let me know if you have any specific powerB -> PureB questions, I'm pretty much up and running with all this now, it took a little while to get used to the syntax changes but it was worth the effort.
There's plenty of PowerB people here asking similar sorts of questings, Elias was asking about "Dim AT" the other month for example.
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Hey ciao Paul.
I missed your "Aussie in Tokyo" signature
Thanks a lot for your reply. I started yesterday to look at PureBasic help file and the many posts here regarding the aspects aI need to cover before making a possible jump from PowerBasic to PureBasic. No doubt I can do all I need in PureBasic but not to convert thinBasic from PowerBasic to PureBasic due to clear licence rule not to develop internal PureBasic command wrappers, and an interpreter have, more or less, a lot of wrappers of some (many) of the compiler's commands.
thinBasic project is now more than 140000 lines of code (not considering the many standard compiler includes), so before making any move I need to fix all my doubts on the development environment I choose. PureBasic was my last chance to remain with a Basic language for thinBasic project development, at this point C and possibly C++ seem a more convenient way to go.
My main reason why I'm searching for a new dev environment is the discussion I had with PowerBasic owner and the hate he seems to have for me. For what is my experience, PowerBasic compiler is really a good compiler full of unique features but the company behind seems to lack in medium/long strategy (they hide this missing strategic view behind their "no vaporware" policy). Also the community there seems more motivated to talk about religion and politics other than tech and programming aspects.
Even if I cannot use PureBasic for thinBasic project, I will continue to study it for my company. Her we need a fast dev environment focused on ODBC handling. I will be around for some days to study more.
Thanks a lot for your support.
Ciao
Eros
I missed your "Aussie in Tokyo" signature

Thanks a lot for your reply. I started yesterday to look at PureBasic help file and the many posts here regarding the aspects aI need to cover before making a possible jump from PowerBasic to PureBasic. No doubt I can do all I need in PureBasic but not to convert thinBasic from PowerBasic to PureBasic due to clear licence rule not to develop internal PureBasic command wrappers, and an interpreter have, more or less, a lot of wrappers of some (many) of the compiler's commands.
thinBasic project is now more than 140000 lines of code (not considering the many standard compiler includes), so before making any move I need to fix all my doubts on the development environment I choose. PureBasic was my last chance to remain with a Basic language for thinBasic project development, at this point C and possibly C++ seem a more convenient way to go.
My main reason why I'm searching for a new dev environment is the discussion I had with PowerBasic owner and the hate he seems to have for me. For what is my experience, PowerBasic compiler is really a good compiler full of unique features but the company behind seems to lack in medium/long strategy (they hide this missing strategic view behind their "no vaporware" policy). Also the community there seems more motivated to talk about religion and politics other than tech and programming aspects.
Even if I cannot use PureBasic for thinBasic project, I will continue to study it for my company. Her we need a fast dev environment focused on ODBC handling. I will be around for some days to study more.
Thanks a lot for your support.
Ciao
Eros
Beware of the OpenWindow() command. Crap, should have told you this before you made a purchase. PB does have a nasty habit of formatting your hard drive everytime your try and open a window.erosolmi wrote:I've just bought my new PureBasic copy.
All went straight and efficiently and this is not a bad start at all
Eros
As for closing the window, best not go there!

Seriously, welcome to Purebasic. Reckon you've made a good choice.
I may look like a mule, but I'm not a complete ass.