Lates PB Gazette - PowerLIBS?!?!?!?

Started by Paul Squires, June 17, 2010, 07:28:59 PM

Previous topic - Next topic

Paul Squires

Got wicked excited thinking that PB had finally implemented static library linking.

Nope, a "PowerLIB" is sadly not static linking. Maybe in few more years...


Paul Squires
PlanetSquires Software

Michael Stefanik

#1
This is has been discussed on and off over the past years, and it always comes back to this: static link with what kinds of libraries exactly? A DLL exposes a standardized interface through the functions that it exports. There is no such standard for static link libraries. So what object format should they support? COFF? OMF? ELF? What symbol decoration should they use? Microsoft's? Borland's? What happens if the static library was created using C++, instead of plain C? Or was created using Pascal? And then what happens if the static library that you're linking to was created using Visual C++ and LTCG (link time code generation, which is the default for release builds), where the output isn't the standard COFF object format, but rather an IL (intermediate language) format which is used by Visual C++ to perform whole program optimization when it builds the executable?

As you can see, this issue is not nearly as cut-and-dried as a lot of people seem to think it is. Of course, PowerBasic could standardize on a particular format, say COFF and they could choose a naming convention and create static libraries that they could link to. But it's likely no one else could link to them, and you wouldn't be able to link to static libraries from various other languages and compilers. So the only "market" for PB static libraries would be other PB programmers. While I understand that would be useful in specific situations (such as yours), looking at the broader market, I'm not sure that it would ever be the case that there would be enough "bang for the buck" for them to do this. And if they did implement static linking, I could pretty much guarantee a flood of support questions like "Why can't I link against foobar.lib created with [insert compiler here]? I'm getting an error saying it's in an invalid object format."

Edit: Oh, and another thing I forgot is that for Visual C++ static libraries, there's different options for the way they're built and how they link against the C runtime library; how should they handle the case where you have a static library that was built using standard C functions (fopen, gets, etc.) where either the /MT or /MTd options are used? What happens if the library uses the C++ classes in MFC? PowerBasic wouldn't be able to link it in at all unless it had those libraries to link against; you'd be getting a slew of errors about unresolved symbols. Like I said, it's a messy issue.
Mike Stefanik
sockettools.com

Michael Stefanik

#2
My point being is that there simply wouldn't be that much bang for the buck; the number of developers who would gain siginificant (commercial) benefits from this would be fairly small, I think you'd have to agree. I just don't see the financial incentive for them to invest all of that time and effort for this feature when they could be working on much more important stuff.
Mike Stefanik
sockettools.com