[SOLVED] its possible Read a method from a executable file ?
[SOLVED] its possible Read a method from a executable file ?
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.
Re: its possible Read a method from a executable file ?
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
Re: its possible Read a method from a executable file ?
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
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.
Re: its possible Read a method from a executable file ?
have a look at HX DOS-Extender https://sourceforge.net/projects/hx-dos/files/
Re: its possible Read a method from a executable file ?
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.
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.
Re: its possible Read a method from a executable file ?
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.exagonx wrote: ↑Nov 13, 2023 2:59Thank 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 )
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.22Code: 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
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.
Re: its possible Read a method from a executable file ?
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
Re: its possible Read a method from a executable file ?
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 perfectlycaseih 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.
Re: its possible Read a method from a executable file ?
Imortis wrote: ↑Nov 13, 2023 15:50What 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.exagonx wrote: ↑Nov 13, 2023 2:59Thank 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 )
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.22Code: 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
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.
The version was the 1.09 after upgrade to the 1.10 its work fine.
Thank you guys you are very kind.
Re: its possible Read a method from a executable file ?
This extension seems interesting if it does what I think is possible to create a windows 95 type multitasking environment.srvaldez wrote: ↑Nov 13, 2023 9:45 have a look at HX DOS-Extender https://sourceforge.net/projects/hx-dos/files/
I'll look at it calmly when I have more free time, thanks for the suggestion.