how to inline assembler into gcc-FORTRAN program?

David Livshin david.livshin@dalsoft.com
Wed Jul 25 09:28:00 GMT 2007


Daniel Franke wrote:
> 2007/7/25, David Livshin <david.livshin@dalsoft.com>:
>> Any ideas how can it be done in gfortran?
>
> Create a C-function
>  asm_marker() {
>    /* your asm code here */
>  }
>
> In Fortran:
>  CALL asm_marker_()
>  ! your fortran code here
>  CALL asm_marker_()
>
> (Or use the new C binding feature to omit the decorating '_')
>
> This also adds the function call to asm_marker() to your marker code,
> but if you only want to identify a region of assembler code, that
> shouldn't make a difference.
>
> Regards
>     Daniel
>
Thanks, but this solution is less than satisfactory, because:

1. It requires an extra function ( even dummy one ) to be supplied at 
the link time

2. It doesn't allow to specify "parameters" to the delimiter - in my 
case the delimiter is any comment that begins with ".start_dco" - 
".start_dco" is used to recognize the delimiter and anything that 
follows it is parsed as "parameters" ( see 
http://www.dalsoft.com/documentation_manual.html#mozTocId452659 and 
http://www.dalsoft.com/documentation_manual.html#mozTocId235475 for 
details ).

-- 
David Livshin

http://www.dalsoft.com



More information about the Fortran mailing list