Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CHAIN command not working
#4
It works for me anyway. "Shared" must be used when transferring to an external function in the called program. Otherwise not necessary.

Program 1
Code: (Select All)
'Beispiel fuer Chain. - 8. Juli 2022
'Aufruf einer externen Funktion die
'den GGT berechnet

Common Shared Zahl1, Zahl2 As Long

Print
Print "Berechnet den GGT zweier Zahlen"
Print

Input "Zahl 1: ", Zahl1
Input "Zahl 2: ", Zahl2

'Ruft externes Programm auf das mit
'den Zahlen den GGT berechnet
Chain "GGT-externe-Funktion"

End

Program 2 (Will be called.)
Code: (Select All)
'Wird von "Aufruf-externe-FunktionGGT" aufgerufen - 8. Juli 2022
'Berechnet mit den uebergebenen Zahlen
'den GGT

'Geht nur mit dem Schluesselwort "Shared"
Declare Function ggt(zahl1, zahl2 as Long) as Long

Common Shared Zahl1, Zahl2 As Long

Print: Print
Print Using "Der gemeinsame Teiler von ##### und ##### ist: ####"; Zahl1, Zahl2, ggt(Zahl1, Zahl2)

End 'Externes Hauptprogramm

Function ggt (zahl1, zahl2 As Long)

  Dim temp As Long

  While (zahl1 > 0)
    If (zahl1 < zahl2) Then
      temp = zahl1: zahl1 = zahl2: zahl2 = temp
    End If
    zahl1 = zahl1 - zahl2
  Wend
  ggt = zahl2

End Function

[Image: Extern-GGT2022-08-08.jpg]
Reply


Messages In This Thread
CHAIN command not working - by TerryRitchie - 08-08-2022, 04:02 AM
RE: CHAIN command not working - by bplus - 08-08-2022, 03:00 PM
RE: CHAIN command not working - by mdijkens - 08-08-2022, 03:28 PM
RE: CHAIN command not working - by mnrvovrfc - 08-08-2022, 10:47 PM
RE: CHAIN command not working - by Kernelpanic - 08-08-2022, 04:04 PM
RE: CHAIN command not working - by TerryRitchie - 08-08-2022, 08:07 PM
RE: CHAIN command not working - by Kernelpanic - 08-08-2022, 08:56 PM
RE: CHAIN command not working - by TerryRitchie - 08-08-2022, 09:25 PM
RE: CHAIN command not working - by SMcNeill - 08-08-2022, 11:34 PM
RE: CHAIN command not working - by Pete - 08-09-2022, 06:09 AM
RE: CHAIN command not working - by TempodiBasic - 08-12-2022, 05:35 PM
RE: CHAIN command not working - by TempodiBasic - 09-01-2022, 12:13 AM
RE: CHAIN command not working - by Udix - 11-01-2022, 01:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  plotting shapes not working madscijr 6 658 10-22-2025, 05:29 AM
Last Post: SMcNeill
  why isn't _FULLSCREEN working? madscijr 5 533 09-20-2025, 01:47 AM
Last Post: SMcNeill
  I'm working on an old MS-DOS thingy... KlamPs 2 519 08-25-2025, 09:43 AM
Last Post: hsiangch_ong
  Command$(count%) - I can't get a value when using the optional argument "(count%)" Unatic 3 530 08-22-2025, 11:58 AM
Last Post: Unatic
  keyword to get the EXE name and the EXE path instead of parsing Command$(0) ? madscijr 8 1,159 07-22-2025, 08:35 PM
Last Post: hsiangch_ong

Forum Jump:


Users browsing this thread: 1 Guest(s)