[Solved]Polink error with a UserLib (compiled with TailBite)

Just starting out? Need help? Post your questions and find answers here.
lionel_om
User
User
Posts: 31
Joined: Wed Jul 18, 2007 4:14 pm
Location: France

[Solved]Polink error with a UserLib (compiled with TailBite)

Post 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
Last edited by lionel_om on Wed Nov 14, 2007 12:29 pm, edited 1 time in total.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

Hi,

you have to TailBite in ThreadSafe mode :
Image
in the PB-IDE you have to set the subsystem in the compiler-options :
Image

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
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
lionel_om
User
User
Posts: 31
Joined: Wed Jul 18, 2007 4:14 pm
Location: France

Post 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
Last edited by lionel_om on Wed Nov 14, 2007 12:42 pm, edited 1 time in total.
Webmaster of Basic-univers
lionel_om
User
User
Posts: 31
Joined: Wed Jul 18, 2007 4:14 pm
Location: France

Post by lionel_om »

Great it works now.
Thanks everyone !!!!!

Lio :D
Webmaster of Basic-univers
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post 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 :
ImageImage
lionel_om
User
User
Posts: 31
Joined: Wed Jul 18, 2007 4:14 pm
Location: France

Post 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
Webmaster of Basic-univers
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
lionel_om
User
User
Posts: 31
Joined: Wed Jul 18, 2007 4:14 pm
Location: France

Post 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...
Webmaster of Basic-univers
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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!
I may look like a mule, but I'm not a complete ass.
lionel_om
User
User
Posts: 31
Joined: Wed Jul 18, 2007 4:14 pm
Location: France

Post 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?
Webmaster of Basic-univers
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
lionel_om
User
User
Posts: 31
Joined: Wed Jul 18, 2007 4:14 pm
Location: France

Post 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
Webmaster of Basic-univers
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply