Page 1 of 1
[Solved]Polink error with a UserLib (compiled with TailBite)
Posted: Wed Nov 14, 2007 11:28 am
by lionel_om
Hi everyone,
I have compile a library with TailBite (without Thread Safe option), but when I want to use these functions I got the following Polink error :
Unresolved external symbol '_PB_StringBasePosition'
This error only appear when using certain functions, some of them perfectly works. For instance the function which don't work call PB's ExamineDirectory() procedure.
Then I recompile it with Thread Safe option, in spite of I never use Thread in my Lib. Now My last example file works, but not the previous one.
Now the missing functions are at least ''
_SYS_CheckProcedureStringBuffer' and '
_SYS_FreeProcedureStringBuffer' in spite of in some example I don't use String functions.
I've already ask some help on the French forum, but no one got an idea.
My sources are
there
In this zip there are all sources codes, the Res and the Lib compiled without Thread Safe option.
Thanks for your help
Lio
Posted: Wed Nov 14, 2007 11:51 am
by srod
This definitely looks like a threadsafe problem and use of the wrong library. You may not be using strings in your code, but ExamineDirectory() will be!
Try re-tailbiting (make sure you use the latest version of Tailbite and PB) and double check that the threadsafe option is cleared.
Then run your program again, double checking that the threadsafe option is cleared.
If this doesn't work then please feel free to pm me and I'll supply an e-mail address for you to send a copy of the library etc. I'll check it on my system if you like.
Posted: Wed Nov 14, 2007 11:59 am
by ABBKlaus
Hi,
you have to TailBite in ThreadSafe mode :

in the PB-IDE you have to set the subsystem in the compiler-options :
Here is your lib compiled in threadsafe/unicode mode :
http://www.purebasicpower.de/downloads/ ... urces2.zip
PS : changed all examples to use the '
UserLibUnicode'
Regards Klaus
Posted: Wed Nov 14, 2007 12:01 pm
by gnozal
I just Tailbited your source [using last jaPBe V3 - Menu->Project->Tailbite] (without Thread Safe option).
I ran your ExamineDirectory.pb4 example : no problem.
Posted: Wed Nov 14, 2007 12:03 pm
by lionel_om
I use the last version of PB (4.10f) and Tailbite (1.3PR1.8 ) and I'm sure that Thread Safe option is unchecked.
There is a link to my source code in the post above and all files needed (excepted the CHM file but right now it is useless).
Thank for your help.
Lio
Posted: Wed Nov 14, 2007 12:28 pm
by lionel_om
Great it works now.
Thanks everyone !!!!!
Lio

Posted: Wed Nov 14, 2007 12:30 pm
by ABBKlaus
You should use the latest version of TailBite V1.3PR1.859 :
http://www.tailbite.com/?download=TailB ... taller.exe
With the false combination of 'Compiler Options' i get the same errors :


Posted: Wed Nov 14, 2007 12:41 pm
by lionel_om
Yes I've just seen (thanks to your comments) thank I've to check this option.
And I have to compile my sources with the 4 different combinations options ?
- [ ] ThreadSafe and [ ] Unicode
- [x] ThreadSafe and [ ] Unicode
- [ ] ThreadSafe and [x] Unicode
- [x] ThreadSafe and [x] Unicode
And put the first one the the folder PureLibraries\UserLibraries and the others in a folder in 'SubSystems' ?
Thanks
Lio
Posted: Wed Nov 14, 2007 12:47 pm
by gnozal
lionel_om wrote:And I have to compile my sources with the 4 different combinations options ?
- [ ] ThreadSafe and [ ] Unicode
- [x] ThreadSafe and [ ] Unicode
- [ ] ThreadSafe and [x] Unicode
- [x] ThreadSafe and [x] Unicode
Yes, if your lib supports it.
lionel_om wrote:And put the first one the the folder PureLibraries\UserLibraries and the others in a folder in 'SubSystems' ?
Yes.
Note that if you are using the jaPBe Tailbite tool, the libs are placed automatically in the adapted folder after compilation.
Posted: Wed Nov 14, 2007 12:52 pm
by lionel_om
gnozal wrote:lionel_om wrote:And I have to compile my sources with the 4 different combinations options ?
- [ ] ThreadSafe and [ ] Unicode
- [x] ThreadSafe and [ ] Unicode
- [ ] ThreadSafe and [x] Unicode
- [x] ThreadSafe and [x] Unicode
Yes, if your lib supports it.
How to know if it is supported ?
For ThreadSafe it should be ok because I use Mutex.
But for Unicode I don't know if it is compatible...
Posted: Wed Nov 14, 2007 1:31 pm
by srod
Unicode is supported if you decide to support it!
Seriously, if your library uses strings then it is usually a good idea to create a unicode version (via the unicode switch etc.)
Personally, I always have the unicode option set by default these days and create non-unicode versions of my libraries as an after thought!
Posted: Wed Nov 14, 2007 1:44 pm
by lionel_om
But technically have I to take care about some things ?
I think that when using Unicode we must use StringByteLength() instead of Len() when allocating string memory. But is there some other thinks that I have to take care about?
Posted: Wed Nov 14, 2007 1:50 pm
by srod
lionel_om wrote:But technically have I to take care about some things ?
I think that when using Unicode we must use StringByteLength() instead of Len() when allocating string memory. But is there some other thinks that I have to take care about?
Only if using utf-8. With Ascii/Unicode, memory can be allocated via :
Code: Select all
mem = AllocateMemory((Len(MyString$)+1)*SizeOf(Character))
etc.
Purebasic does most of the work for us when using Unicode, right down to using api functions. For example, if you use the DrawText_() function, Purebasic will substitute this for DrawTextA_() if compiling in Ascii mode, and DrawTextW_() if compiling for unicode etc.
Occasionally, I do find myself having to convert unicode strings to Ascii etc. but this is a breeze using PokeS() and PeekS() etc.
No, there really is little to worry about.
Posted: Wed Nov 14, 2007 2:03 pm
by lionel_om
Thanks very much srod for this information.
Tack (as we said in Sweden).
So now I'm able to distribute my userlib.
Lio
Posted: Wed Nov 14, 2007 3:43 pm
by gnozal
lionel_om wrote:... But is there some other thinks that I have to take care about?
Purebasic should handle most of the unicode stuff, but if you are using an external library that doesn't support unicode [ZLIB ...] or talking to servers that only speak ANSI [SMTP ...], then you have to convert ANSI to unicode and unicode to ANSI whenever it is needed.