[SOLVED] its possible Read a method from a executable file ?

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

[SOLVED] its possible Read a method from a executable file ?

Post by exagonx »

Good morning friends, this morning I was experimenting with QBasic4.5 and I was wondering if it was possible with FreeBASIC to read subs and functions of an executable file and download them from memory when they are no longer needed.
Last edited by exagonx on Nov 13, 2023 22:22, edited 1 time in total.
caseih
Posts: 2159
Joined: Feb 26, 2007 5:32

Re: its possible Read a method from a executable file ?

Post by caseih »

I believe FB can support DJGPP's DXE files, which are like DLLs. You can use DYLIBLOAD and friends to read and call functions in the DXE, and unload them when not needed. See https://www.freebasic.net/wiki/ProPgSharedLibrariesDOS
exagonx
Posts: 316
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: its possible Read a method from a executable file ?

Post by exagonx »

Thank you for your kind reply, unfortunately the example shown in the link works perfectly under Windows and Linux but under MSDOS 6.22 and FreeDOS it gives an error when compiling m1.bas and m2.bas

below is the answer when I proceed using DOS, ( FreeDOS, MS DOS )

Code: Select all

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc d1.bas

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc m1.bas
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x11c): undefined reference to 'fb_hArrayFreeTmpDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x234): undefined reference to 'fb_ArrayAllocTempDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0xd14): undefined reference to 'fb_hArrayAllocTmpDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0xf94): undefined reference to 'fb_ArrayFreeTempDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x1574): undefined reference to 'fb_ArraySetDesc'

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc m2.bas
ld: cannot find -ld1_il


I tried both on a virtual machine with virtual box, vmware believing incompatibility and on a real machine an old Pentium 2 with MSDOS 6.22

Exactly same result, I copied the example without changing anything but under DOS it doesn't work

If it were possible to make the use of shared libraries work under DOS it would be possible to create environments capable of operating with 1 Mega support and making even an old 486 usable.
srvaldez
Posts: 3401
Joined: Sep 25, 2005 21:54

Re: its possible Read a method from a executable file ?

Post by srvaldez »

have a look at HX DOS-Extender https://sourceforge.net/projects/hx-dos/files/
caseih
Posts: 2159
Joined: Feb 26, 2007 5:32

Re: its possible Read a method from a executable file ?

Post by caseih »

As I understand it, the DJGPP compiler suite that FB for DOS uses includes its own DOS Extender. Binaries produced by FBC should be 32-bit already, even on DOS, so capable of supporting much more than 1 MB RAM.

I've never used FB for DOS, but quite a few forum members have. Hopefully someone can chime in and speak to why the FB wiki example isn't working for you.

You are using the latest version of FB for DOS, 1.10, correct? DXE support was only introduced in 1.06.
Imortis
Moderator
Posts: 1929
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: its possible Read a method from a executable file ?

Post by Imortis »

exagonx wrote: Nov 13, 2023 2:59
Thank you for your kind reply, unfortunately the example shown in the link works perfectly under Windows and Linux but under MSDOS 6.22 and FreeDOS it gives an error when compiling m1.bas and m2.bas

below is the answer when I proceed using DOS, ( FreeDOS, MS DOS )

Code: Select all

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc d1.bas

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc m1.bas
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x11c): undefined reference to 'fb_hArrayFreeTmpDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x234): undefined reference to 'fb_ArrayAllocTempDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0xd14): undefined reference to 'fb_hArrayAllocTmpDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0xf94): undefined reference to 'fb_ArrayFreeTempDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x1574): undefined reference to 'fb_ArraySetDesc'

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc m2.bas
ld: cannot find -ld1_il


I tried both on a virtual machine with virtual box, vmware believing incompatibility and on a real machine an old Pentium 2 with MSDOS 6.22

Exactly same result, I copied the example without changing anything but under DOS it doesn't work

If it were possible to make the use of shared libraries work under DOS it would be possible to create environments capable of operating with 1 Mega support and making even an old 486 usable.
What version of FB are you using? If it is anything prior to 1.06, then you don't have the capabilities you are looking for. Also, it would be best to get the most recent version as 1.06 only had partial support for DXEs. I am not sure how complete it is as of the newest, but there are improvements.
angros47
Posts: 2331
Joined: Jun 21, 2005 19:04

Re: its possible Read a method from a executable file ?

Post by angros47 »

Also, to load a .DXE module you must specify the extension ",dxe", while under Windows and Linux this is not required, so the program requires slight changes
exagonx
Posts: 316
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: its possible Read a method from a executable file ?

Post by exagonx »

caseih wrote: Nov 13, 2023 15:40 As I understand it, the DJGPP compiler suite that FB for DOS uses includes its own DOS Extender. Binaries produced by FBC should be 32-bit already, even on DOS, so capable of supporting much more than 1 MB RAM.

I've never used FB for DOS, but quite a few forum members have. Hopefully someone can chime in and speak to why the FB wiki example isn't working for you.

You are using the latest version of FB for DOS, 1.10, correct? DXE support was only introduced in 1.06.
Thanks so much for the suggestion, my version was 1.09 reading that the version needed was 1.06 I thought it was fine, but after updating to version 1.10 it seems to work perfectly
exagonx
Posts: 316
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: its possible Read a method from a executable file ?

Post by exagonx »

Imortis wrote: Nov 13, 2023 15:50
exagonx wrote: Nov 13, 2023 2:59
Thank you for your kind reply, unfortunately the example shown in the link works perfectly under Windows and Linux but under MSDOS 6.22 and FreeDOS it gives an error when compiling m1.bas and m2.bas

below is the answer when I proceed using DOS, ( FreeDOS, MS DOS )

Code: Select all

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc d1.bas

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc m1.bas
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x11c): undefined reference to 'fb_hArrayFreeTmpDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x234): undefined reference to 'fb_ArrayAllocTempDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0xd14): undefined reference to 'fb_hArrayAllocTmpDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0xf94): undefined reference to 'fb_ArrayFreeTempDesc'
C:\fbc\lib\dos/libfb.a(sys_dylib.o):sys_dylib.c:(.data+0x1574): undefined reference to 'fb_ArraySetDesc'

C:\DOCUMENT\DEVELOP\FreeBASIC\DLLDOS>fbc m2.bas
ld: cannot find -ld1_il


I tried both on a virtual machine with virtual box, vmware believing incompatibility and on a real machine an old Pentium 2 with MSDOS 6.22

Exactly same result, I copied the example without changing anything but under DOS it doesn't work

If it were possible to make the use of shared libraries work under DOS it would be possible to create environments capable of operating with 1 Mega support and making even an old 486 usable.
What version of FB are you using? If it is anything prior to 1.06, then you don't have the capabilities you are looking for. Also, it would be best to get the most recent version as 1.06 only had partial support for DXEs. I am not sure how complete it is as of the newest, but there are improvements.

The version was the 1.09 after upgrade to the 1.10 its work fine.

Thank you guys you are very kind.
exagonx
Posts: 316
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: its possible Read a method from a executable file ?

Post by exagonx »

srvaldez wrote: Nov 13, 2023 9:45 have a look at HX DOS-Extender https://sourceforge.net/projects/hx-dos/files/
This extension seems interesting if it does what I think is possible to create a windows 95 type multitasking environment.

I'll look at it calmly when I have more free time, thanks for the suggestion.
Post Reply