Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: kas1e on March 01, 2005, 03:59:09 AM
-
hello 2 all, one more lame question. for example i have lala.library (68k/hunk) and this kind of code:
// ----
OpenLibrary(lala.library)
using library calls
CloseLibrary(lala.library)
// ----
Well, in this code i must use inxternal lala.library. Can i create internal code from lala.library ? I mean, i do not want open external library, i just to want put all data to one executable (put library in code). Any way ? I need it for sasc/vbcc and in last case for gcc maybe. I do not have sources of this library. So, maybe any 3d party tools ? fd2pragma maybe ? Of course i can create char array from my library, after run code create file from this char, open it as library, use calls, close, erase :) but it is a mess..
sorry for poor english.
-
Not only is there no easy way to do this without source code, it is likely that there is no LEGAL way to do this.
If you do not have the source code I assume that the library you refer to does not belong to you. Building it into your own code is likely to be a breach of some intellectual property law.
Also, I can't really think of a good reason to do this (except for as a means of distributing libraries that you depend on that you are not entitled to distribute).
-
these librarys as 'freeware', but too many authorsdead/leave/etc. So, it is no way to have source code (but of course these library is free).
Anyway, here is no question about LAW/RIGHT, here is technical question.
-
@kas1e
these librarys as 'freeware', but too many authorsdead/leave/etc.
This fights against the very idea of libraries: Making it easy to upgrade the library!
Anyway, here is no question about LAW/RIGHT, here is technical question.
Embedding a library into some binary is possible, and it has been done. But since it's ugly and totally against the idea of the shared libraries, I won't get into details.
Just provide a proper install script that copies the library over (unless if there's newer version installed already).
-
well. here is example, we have:
1.little binary(20k)
2.little library(10k)
3.tool like UPX (which pack executable with adding self decrunch data + decrunch header into new exefile)
We pack exe, to 10k. And can't pack library. If, we embedding library to binary, it possible to pack all code. And it will look more compactly.
Next example, it is too many buggest amiga librarys from version to version. For example user have 1.2 version of library (it is work fine with some user programs) and i have 1.3 (it is work for me too, but for some programs from user, it is do not work, becouse problem in new library fixes/codes/etc). I am replace user library, and .. it is suxx. So, it is one more + to embedet library to binary.
ps. of course i am understand that it's not good way. but! i do not have to create big project with this kind of hack, i just want to create some little project.
-
You really do not need to pack executables anymore. Packing is ugly, unnecessary, and fscks up the DOS loader. I'll admit, everything in one file looks cool. But there really is little difference between creating a directory and dumping all stuff there and a single file. Second, if library versions are so important, you embed a check in your code with the OpenLibrary() call to print a warning that if the right version is not present, the program will not run correctly. You ship the program with the correct version of the library. If the code is so sensitive to the correct version, you might want to think about coding a workaround, bugging the author, or if he is not active any longer, creating your own library to do the job. Finally, embedding code into your own executable requires you to know a lot about the library's own code and data segments and making sure those sections end up in the right kind of memory. Under OS3- that doesn't make one iota of difference, but OS4+ might actually respect certain flags and allocate memory appropriately. In other words, you need to mimick the OpenLibrary()-process on your own: bad, bad idea.
It is sooo much easier just to ship the right version with your code and issue a warning otherwise, it's almost painful.
-
Privet! :)
Are u trying to make a cli command?
Or will ur util be loaded from workbench with an icon?
-
If you have the function descriptor, then you know how to call the library's functions. If you have the library, then you know how to determine the offsets of the library's functions. It might be possible to link the object code into yours and call the functions with an understanding of the overall layout; however, if the library calls any of its own functions or any other internal functions, you're still hosed. So, you'd have to decompile the library and go from there.
So, anything is technically possible, but is the benefit worth the cost?
Trev
P.S. In the United States, all creative works, including software source and object code, are implicitly copyrighted unless they're explicitly placed in the public domain. "Freeware" is copyrighted software licensed free of charge for limited use. Be sure to consult your own country's copyright laws, international treaties, and the country of origin's copyright laws before publicly distributing your work. (Private, non-commerical use typically qualifies as a fair use in countries that apply the fair use doctrine.)