Multi-threading dos problem

DOS specific questions.
Cpcdos
Posts: 207
Joined: Mar 06, 2013 13:52
Location: France - LYON 69003
Contact:

Multi-threading dos problem

Postby Cpcdos » May 24, 2014 18:03

Hello!

I do full research, and i have found a freebasic lib for use multi-thread with Freedos and dpmi
Source code of THREADS.BAS :

Code: Select all

sub threadProcedure( byval userdata as any ptr )
   for i as integer = 0 to 4
      print i
      sleep 500, 1
   next
end sub

print "starting thread..."
dim as any ptr threadid = threadcreate( @threadProcedure, 0 )

print "waiting for thread to finish..."
threadwait( threadid )

print "finished"
sleep


When compile, i have this.. can you help me please ? :/

Image
With or not with -mt i have the same problem
I have tested of just copy "libfbmt.a" but i have the same problem
dkl
Site Admin
Posts: 3212
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Multi-threading dos problem

Postby dkl » May 25, 2014 11:50

Looks like a version mismatch: new fbrt0.o (which wants fb_hRtInit/Exit()) vs. very old libfb.a (which didn't have these functions yet).

The safe solution is to use the same version of everything - fbc, fbrt0, libfb. fbc is unfortunately not guaranteed to be backwards-compatible to older versions of libfb either.
Cpcdos
Posts: 207
Joined: Mar 06, 2013 13:52
Location: France - LYON 69003
Contact:

Re: Multi-threading dos problem

Postby Cpcdos » May 28, 2014 9:13

Thank you for your reply,

hm.... I'm confused, i use the last version of freebasic (0.90.1) , this funtion is deleted ?

I have see fbtr0.o in hexadecimal, there are :
_fb_hRtExit
_fb_hRtInit


and in libfbmt.a there are :
fb_hRtExit
fb_hRtInit


Why there is not « _ » ??

Thank
dkl
Site Admin
Posts: 3212
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Multi-threading dos problem

Postby dkl » May 28, 2014 14:27

What libfbmt.a is this? The FreeBASIC-0.90.1-dos package does not include a libfbmt.a.

FB does not support multi-threading for DOS out-of-the-box currently. Is this about the Multithreading in DOS patch? I don't know how well it works.

Or are you using the libs from that libfreebasic_0.18.2b_i386.deb Debian Linux package? Those surely are for Linux, not for DOS. (not to mention that that package is hopelessly outdated and dropped from Debian nowadays)

The libs from the FreeBASIC-0.90.1-dos package look good to me, by the way:
$ i586-pc-msdosdjgpp-nm FreeBASIC-0.90.1-dos/lib/dos/fbrt0.o | grep fb_hRt
U _fb_hRtExit
U _fb_hRtInit
$ i586-pc-msdosdjgpp-nm FreeBASIC-0.90.1-dos/lib/dos/libfb.a | grep fb_hRt
00000060 T _fb_hRtExit
00000010 T _fb_hRtInit
Cpcdos
Posts: 207
Joined: Mar 06, 2013 13:52
Location: France - LYON 69003
Contact:

Re: Multi-threading dos problem

Postby Cpcdos » Jun 01, 2014 12:52

libfbmt.a is a lib for multi-treading

Is this about the Multithreading in DOS patch? I don't know how well it works.

Hm yes! but this patch does not exist for download

I research a solution for use multi-thread with my FreeBaic dos program (work in FreeDos. Not msdos!)
angros47
Posts: 1634
Joined: Jun 21, 2005 19:04

Re: Multi-threading dos problem

Postby angros47 » Jun 01, 2014 13:08

@dkl

Is there any hope that the patches by monochromator (the already cited multithreading patch and the dynamic libraries one) will be part of the dos version of FreeBasic?

Even if they're not perfect... well, dos port of gfx library is not perfect (i.e., has some issues with palettes), but at least it means that the same features are available in all FreeBasic versions, and porting programs is much easier.
dkl
Site Admin
Posts: 3212
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Multi-threading dos problem

Postby dkl » Jun 01, 2014 20:16

Well, sure, it'd be cool to have this working in FB out-of-the-box.

I personally haven't integrated the patches immediately back then because I didn't understand them fully, neither have the knowledge about DOS/DJGPP stuff nor am interested in DOS, and because I think there are some unresolved points that need to be clarified before they can be added to FB.
angros47
Posts: 1634
Joined: Jun 21, 2005 19:04

Re: Multi-threading dos problem

Postby angros47 » Jun 02, 2014 15:01

I fear that nobody fully understands dos programming anymore... if you don't add these features, I doubt that anybody else will: the real question is: are you worried because adding them could break something else? If they require some changes that might affect other features, you are right to wait; but if they just add new code, who cares if it's a bit buggy? The worst that can happen is the new features not working, in case FB for dos will just work like before.

IMHO, if you don't add the patch in the official version, the patch will become obsolete (because it's related to an older version of the compiler), will be forgotten, and soon nobody will know that multitasking and dynamic libraries were actually possible in dos with FreeBasic. On the other hand, if you add the patches, it might be the most important improvement in the dos version since the introduction of the graphic library.
marcov
Posts: 2969
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Multi-threading dos problem

Postby marcov » Jun 02, 2014 21:45

angros47 wrote:I fear that nobody fully understands dos programming anymore...


Well, there are gradiations. Sure, even general DOS knowledge is slightly hard to find, and even harder to get sb to do something.

But knowledge about topics like this, that are not common DOS usage, highly extender dependent, and which _WILL_ break existing code is even totally bordering on extinct, simply because it hardly existed in the first place. Moreover, ask 5 people, and get 6 opinions what should be done.

Probably you get more complaints about increasing the dos distribution's size than people actually using it :-)
angros47
Posts: 1634
Joined: Jun 21, 2005 19:04

Re: Multi-threading dos problem

Postby angros47 » Jun 02, 2014 22:18

Actually, why should it break existing code? Existing code does not use these features, so it won'be affected (at least, with previous version of freebasic, original compiler and patched compiler worked in the same way for program that did't use the new features), and programs using multitasking and libraries...well, they just didn't exist before the patch, so breaking them was impossible.

I'm not asking to develop a patch (I know it's a hard task, and dos version is a low priority): I'm just asking to integrate existing one.

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 1 guest