An Obj module approach

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Tension
User
User
Posts: 29
Joined: Tue Mar 22, 2005 3:19 pm

An Obj module approach

Post by Tension »

Would it be possible for version 4 to support another library approach, using .obj files and then linking them in.

People could create an .obj as a library.

Programs could have a directive up top like:

Code: Select all

CompilerModule "myPath/myLib"
and link in myLib.obj.

Is this feasible? Likely? Pipedream?

It would be great if standard libraries could also be nominated within their own paths in a similar way:

Code: Select all

CompileLibrary "myPath/myLib"
where myPath holds myLib and myLib.res

I would prefer this to having all libs in userlibs folder (but obviously the compile process would still make use of libs installed in the default folder, when required).

It would make dependencies more obvious. Ever wondered what you were missing when a codearchive or demo prog jacked up?
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Sorry to tell you this, but the reason nobody from Fantaisie Software (the PureBasic team) replied until now is because your wish will never happen.

If the user El-Choni would not have created Tailbite, the pb users would not even have a possibility to create their own libs in pb format.

Don't want to sound negative, but that's how it is.

Fantaisie Software is in need to protect their hard work in the build-in standard-libraries.

If users could simply compile to obj files, they could incorporate functions from the build-in standard-libraries, and use these functions with other compilers - and this is stricktly prohibited.

To answer your question:
Yes it would be doable, but it's a pipedream :shock:
Tension
User
User
Posts: 29
Joined: Tue Mar 22, 2005 3:19 pm

Post by Tension »

Hi fsw,

Thanks for the response, although I am not sure I fully understand the issues.

If you or I create an obj file for inclusion into our PureBasic programs, how does that jeapordise PureBasic?

PureBasic can already recognise libs created via tailbite, or through the manipulation of .obj, so surely it is not a huge thing to get an obj attached (just some decs required somewhere and a pass to "Purify" the obj)?

PS: Mind you, I am fairly clueless about the process, so I am not arguing against you. I just don't understand how this can be and so I seem to be in need of some educating.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Tension wrote: If you or I create an obj file for inclusion into our PureBasic programs, how does that jeapordise PureBasic?
You are right.
If you use LIBs for PureBasic it's all OK.

The newest help file says (under 'Terms And Conditions'):
All components, libraries, and binaries are copyrighted by Fantaisie Software. The PureBasic license explicitly forbids the creation of DLLs whose primary function is to serve as a 'wrapper' for PureBasic functions.
You are not allowed to use PureBasic generated DLL's with other compilers, if you just wrap-up pb commands.

This would be expanded to static LIB's if PureBasic could generate OBJ files:
You are not allowed to use PureBasic generated LIBRARIES (DYNAMIC or STATIC) with other compilers, if you just wrap-up pb commands.

Conclusion:
IF PureBasic could generate OBJ files
IF you would use these OBJ files with PureBasic
IF you would use these OBJ files with other compilers, by not just wrapping PB functions
All would be OK.

But because it would be possible to use these OBJ's by other compilers - it would be more difficult for Fantaisie Software to control if somebody just wraps up pb commands or not.

That's why it will never come.

BTW:
If somebody knows better she/he should feel free to speak up.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

I'm not sure, but if think what Tension wants to make is not creating .obj or .lib with Purebasic (even if that would be a cool feature !!), but he wants to include .obj or .lib in a Purebasic project without having to do that with the PurebasicLibraries :)
Well, I think, not really sure...
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

I thought Tension was talking about using libraries from within PB like you
can do in your beloved FreeBasic, FSW ;)

Code: Select all

$inclib: 'msvcrt'
.
.
.
declare function atoi CDECL alias "atoi" ( byval s as string ) as integer
IMHO another cool side-effect would be that it was no longer necessary to name
every exported function "PB_functionName()".
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

traumatic wrote:I thought Tension was talking about using libraries from within PB like you
can do in your beloved FreeBasic, FSW ;)
Hey come on, I didn't mention it at all :wink:
I was tempted though :oops:
:D

BTW: there is only one thing that I would call 'my beloved' and that's my wife. I like FreeBASIC though...
traumatic wrote:

Code: Select all

$inclib: 'msvcrt'
.
.
.
declare function atoi CDECL alias "atoi" ( byval s as string ) as integer
How do YOU know that?
Playing with it... do ya? :D
8)
traumatic wrote: IMHO another cool side-effect would be that it was no longer necessary to name
every exported function "PB_functionName()".
Did you know that in FB you can even EXPORT functions inside EXE's ? 8)
Is it possible with PB ?
Maybe with ProcedureDLL ?
EDIT
Tested ProcedureDLL in normal exe files.
The file is compiled but the function is not exported :cry:

Request new PureBasic command:
ProcedureEXPORTBUTNODLL : exports function in exe files for use with other programs/libraries like GLADE that require exported functions by the caller app.
Last edited by fsw on Tue Mar 29, 2005 9:19 pm, edited 1 time in total.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

fsw wrote:How do YOU know that?
Playing with it... do ya? :D
8)
Hah! *cough* Nah! No! Never! Nope! Niemals! :lol:
Good programmers don't comment their code. It was hard to write, should be hard to read.
Tension
User
User
Posts: 29
Joined: Tue Mar 22, 2005 3:19 pm

Post by Tension »

Polo wrote:I'm not sure, but if think what Tension wants to make is not creating .obj or .lib with Purebasic (even if that would be a cool feature !!), but he wants to include .obj or .lib in a Purebasic project without having to do that with the PurebasicLibraries
traumatic wrote:I thought Tension was talking about using libraries from within PB ..
Yes. :)

Also put Pure libraries anywhere, and get to use them through refering to them in the code.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Tension wrote:
Polo wrote:I'm not sure, but if think what Tension wants to make is not creating .obj or .lib with Purebasic (even if that would be a cool feature !!), but he wants to include .obj or .lib in a Purebasic project without having to do that with the PurebasicLibraries
traumatic wrote:I thought Tension was talking about using libraries from within PB ..
Yes. :)
Freak wrote a tool to make a pb library out of a obj file.
http://freak.purearea.net/tools/LibImporter.zip
Tension wrote: Also put Pure libraries anywhere, and get to use them through refering to them in the code.
In PureBasic you don't have to declare pb libraries before you use them.
All pb library functions that are registered by starting the IDE (even the user libraries) are usable without declaring them.

The only thing to keep in mind is that they must be in pb library format in order to use them, not obj.
Tension
User
User
Posts: 29
Joined: Tue Mar 22, 2005 3:19 pm

Post by Tension »

Hi fsw,

Thanks for the response. :)

Actually what I am wishing for re libraries is:

Those in purelibraries/userlibraries treated as is, that is they remain as a sort of extension of the language.

But also libraries outside of that area that must be specifically referenced in code, a directive up front. So that clutter disappears, and dependencies become more obvious, and so that people can test a 3rd party library without "installing" it into purelibraries/userlibraries, residents and help, instead they can install it into a folder of their choosing which holds those files. This would also mean that code released on, say, PureArea, could show dependencies by having upfront directive like:

CompilerIncludePureLibrary "myPath/myLib"

Which the compiler, during the first parse or tokenising run, would see and then grab that library just as it grabs the purelibraries/userlibraries

And it would make the difference between official purebasic and user enhanced purebasic more obvious.

Hope that made sense.

Also, re obj files, what I am wishing for is that PureBasic recognises standard obj and lib files without us having to stuff around to make the darn things compatible.

Again with a reference to the lib and any declarations or "residents" involved:

CompilerIncludeExternalLibrary "myPath/myLib.obj"

Also hope that made sense.


Basically, I want to cut code to get solutions quickly, not to become a code guru worshipped by people like me. And faffing around to create a user library in a language other than PB adds work. So this request is to have PureBasic's overall approach include .obj, .lib, and standard pure libraries in any darn path the programmer wants. :D

Thanks again.
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

FYI,

LCC-Win32 (see http://www.cs.virginia.edu/~lcc-win32/) has a way of executing code from non-linked .OJB-files at runtime. I don't know whether Pelles-C supports this as well.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

@Tension
your request makes sense, completely sense.

Keep in mind that PureBasic was Fred's sideproject, therefore he didn't had the time to polish PB's development environment in a professional way.
The new Linux IDE beta looks promising though...

Since January 2005 he is selfemployed and working full time at PB.
Let's hope he uses his time wisely, and the next version of PB comes as a nice development environment with every thing the users wished for ages...


In the meantime, back to my beloved ... *cough* ... wife. :wink:
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

fsw wrote:In the meantime, back to my beloved ... *cough* ... wife.
:wink:
LMAO! :lol:
Good programmers don't comment their code. It was hard to write, should be hard to read.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Tension: Basically you can do it by using a PBL (with the DLL importer), which allows work to import any external obj or lib directly in PB by adding them to the linking stage. You can also do a regular PB library which packs a .lib.

fsw: what negatives comments...
Post Reply