[Solved] Shared Lib under DOS

DOS specific questions.
Post Reply
exagonx
Posts: 315
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

[Solved] Shared Lib under DOS

Post by exagonx »

Hello friends.

Lately I have started working on old projects again, unfortunately I find myself in the situation where I find myself with excessively large files given that the same libraries are replicated within the executable, when in reality I could create a smaller executable by exploiting the possibility of sharing the functions in common.

I tried following the instructions and example mentioned at: https://freebasic.net/wiki/ProPgSharedLibrariesDOS

But in addition to giving the error "ld: cannot find -ld1_il" despite being present in the current folder and having followed the instructions step by step, it still doesn't give me an answer, I'm sure there is some step that I haven't understood or without realizing it I'm skipping , all I need is to put a collection of functions and subs in a file that is shared by multiple executables, using Windows and Linux the operation succeeds without a hitch but with FreeDOS, MSDOS 6.22, MSDOS 7.00 I continue to encounter the same error forcing me to use -lib which then turns out to be useless because you might as well include the source directly but at this point it doesn't solve the problem of the excessive size of the executables.
Last edited by exagonx on Nov 13, 2023 22:29, edited 1 time in total.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Shared Lib under DOS

Post by caseih »

EDIT. Did you copy and paste the error, or did it really say it couldn't find libd1_il.a with a number 1 instead of an L?
exagonx
Posts: 315
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: Shared Lib under DOS

Post by exagonx »

caseih wrote: Sep 08, 2023 13:39 EDIT. Did you copy and paste the error, or did it really say it couldn't find libd1_il.a with a number 1 instead of an L?
like in th example I used 1 (number one) and not (Letter) L
And NO, I Use -DLL not -LIB
I need Shared Lib not included in the executable.
$ fbc d1.bas, on DOS, will produce d1.dxe dynamic link library and libd1_il.a import library.

Even if your suggestion in other cases would have given me a quick solution, this time I rechecked every syntax and step, but I still don't understand if it's me or if some step is missing in the example.
Last edited by exagonx on Sep 08, 2023 21:43, edited 1 time in total.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Shared Lib under DOS

Post by caseih »

Apologize for posting. After I posted, I realized I had not fully read the documentation, and I don't have any DOS vms handy to test in either.

Seems like DXEs are less useful than normal shared libraries on other operating systems, since you cannot access anything inside the main EXE from the DXE. So no calls into the FB runtime library (no dynamic strings?) (each DXE gets its own static copy of the runtime library). At least if I read that right. Plus everything still has to fit into memory, so there aren't tons of advantages over normal static exes. I read somewhere that someone had developed an elf binary linker and loader for DOS so you could use elf-formatted shared libraries. But I suspect that has long been abandoned.
exagonx
Posts: 315
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: Shared Lib under DOS

Post by exagonx »

Solved with 1.10 of FreeBASIC Compiler
viewtopic.php?t=32454
Post Reply