Environment:
- PureBasic 6.21 x64
- Windows 10 x64
- C Backend (issue only occurs here)
- ASM Backend works fine
I created a simple PureLibrary using pbcompilerc.exe with the /PURELIBRARY and /THREAD options. The library compiles successfully.
However, when I try to use this library in another file compiled with /THREAD, I get a linker error.
This issue only appears when:
- The C backend is used AND The /THREAD flag is set
- The ASM backend does not have this issue (threaded or not)
File: libTest.pb
Code: Select all
EnableExplicit
DisablePureLibrary Test
ProcedureDLL$ Test(Str$)
ProcedureReturn Trim(Str$)
EndProcedure
Code: Select all
EnableExplicit
Test(" Ups ")
Code: Select all
pbcompilerc.exe "T:\libTest.pb" /THREAD /OPTIMIZER /PURELIBRARY /OUTPUT "Test"
Code: Select all
pbcompilerc.exe "T:\test.pb" /THREAD /OPTIMIZER /OUTPUT "T:\test.exe"
Code: Select all
Error: Linker
error: undefined symbol: PB_StringBasePosition
>>> referenced by Test.lib(purebasicnothread.obj):(.refptr.PB_StringBasePosition)
- If I remove the /THREAD option from either compilation, it works fine.
- This seems to indicate an inconsistency between threaded libraries and the C backend.
- The presence or absence of the /OPTIMIZER flag does not change the outcome.
Thanks!
Console output:
Code: Select all
T:\PB_6.21_x64>pbcompilerc.exe "T:\libTest.pb" /THREAD /PURELIBRARY /OUTPUT "Test"
PureBasic 6.21 - C Backend (Windows - x64)
Compiling T:\libTest.pb
Loading external libraries...
Starting compilation...
6 lines processed.
Creating threaded version of the PureLibrary...
Starting compilation...
6 lines processed.
PureLibrary successfully created: "T:\PB_6.21_x64\purelibraries/userlibraries/Test".
- Feel the ..PuRe.. Power -
T:\PB_6.21_x64>pbcompilerc.exe "T:\test.pb" /THREAD /OUTPUT "T:\test.exe
PureBasic 6.21 - C Backend (Windows - x64)
Compiling T:\test.pb
Loading external libraries...
Starting compilation...
2 lines processed.
Creating executable "T:\test.exe".
Error: Linker
error: undefined symbol: PB_StringBasePosition
>>> referenced by Test.lib(purebasicnothread.obj):(.refptr.PB_StringBasePosition)
T:\PB_6.21_x64>