emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: pietru@caramail.com
To: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: orgbabel with fortran code
Date: Wed, 5 May 2021 23:02:30 +0200	[thread overview]
Message-ID: <trinity-7a25041a-b6e7-45ed-9087-d618b6ad5376-1620248550002@3c-app-mailcom-bs16> (raw)
In-Reply-To: <87eeel2c4u.fsf@web.de>

Have had a first go with your code

I wrote the following, then went inside the code and slammed "C-c C-c" 

#+BEGIN_SRC fortran :tangle fortran-comline.f90
program cli
  implicit none ! no implicit declaration: all variables must be declared
  character(1000) :: arg
  
  call get_command_argument(1, arg) ! result is stored in arg, see 
  ! https://gcc.gnu.org/onlinedocs/gfortran/GET_005fCOMMAND_005fARGUMENT.html
  
  if (len_trim(arg) == 0) then ! no argument given
      write (*,*) "Call me --world!"
  else
      if (trim(arg) == "--world") then
          call get_command_argument(2, arg)
          if (len_trim(arg) == 0) then
              arg = "again!"
          end if
          write (*,*) "Hello ", trim(arg)
          ! trim reduces the fixed-size array to non-blank letters
      end if
  end if
end program
#+END_SRC

And then I wrote this, went inside the code and slammed "C-c C-c" 

#+BEGIN_SRC sh :results output :exports both
  gfortran -std=gnu -O3 fortran-comline.f90 -o fortran-comline
  ./fortran-comline
  ./fortran-comline --world World
  ./fortran-comline --world
#+END_SRC

But I am getting some major whining

/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
sh: 2: ./fortran-comline: not found
sh: 3: ./fortran-comline: not found
sh: 4: ./fortran-comline: not found



> Sent: Thursday, May 06, 2021 at 7:50 AM
> From: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
> To: pietru@caramail.com
> Cc: emacs-orgmode@gnu.org
> Subject: Re: orgbabel with fortran code
>
> pietru@caramail.com writes:
> 
> > Have you got exomples with fortran code yourself?  I would like to scrutinise them. 
> 
> I have this, but I no longer know whether it actually executes fortran
> inline or only tangles it:
> 
> https://www.draketo.de/files/2017-04-10-Mo-fortran-commandline-tool.org
> https://www.draketo.de/files/surprises.org
> 
> From
> https://www.draketo.de/english/free-software/fortran
> https://www.draketo.de/light/english/fortran-surprises
> 
> Best wishes,
> Arne
> -- 
> Unpolitisch sein
> heißt politisch sein
> ohne es zu merken
> Message-ID: <87h7jh2qh7.fsf@web.de>
>


  parent reply	other threads:[~2021-05-05 21:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05  5:41 orgbabel with fortran code pietru
2021-05-05  6:24 ` Eric S Fraga
2021-05-05  6:37   ` pietru
2021-05-05  6:52     ` Eric S Fraga
2021-05-05  7:09       ` pietru
2021-05-05  7:14       ` pietru
2021-05-05  7:20         ` Eric S Fraga
2021-05-05  7:24           ` pietru
2021-05-05  7:14 ` Dr. Arne Babenhauserheide
2021-05-05  7:23   ` pietru
2021-05-05 19:50     ` Dr. Arne Babenhauserheide
2021-05-05 20:36       ` Christopher Dimech
2021-05-05 20:46       ` pietru
2021-05-05 20:53         ` Dr. Arne Babenhauserheide
2021-05-05 21:04           ` pietru
2021-05-05 21:02       ` pietru [this message]
2021-05-05 21:08       ` pietru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-7a25041a-b6e7-45ed-9087-d618b6ad5376-1620248550002@3c-app-mailcom-bs16 \
    --to=pietru@caramail.com \
    --cc=arne_bab@web.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).