The Crystal Programming Language Forum

Do annotation arguments have to be literal?

Hi, really enjoying learning crystal. I am trying to wrap some fortran code, and needing to fiddle around a bit with the ldflags in the Link annotation. Do those have to be literal? Tried this, which isn’t working

macro ld_flags()
    "-L/home/pjw/Projects/qfin/extern -l:saxpy.a -lgfortran" 
end                           
 
@[Link(ldflags: ld_flags())]
lib Test1                      
    fun testingfor(x : Float64*)
end

Yes, but try like this instead

{% begin %}
  {% f = "-L/home/pjw/Projects/qfin/extern -l:saxpy.a -lgfortran" %}
  @[Link(ldflags: {{f}})]
{% end %}
lib Test1                      
    fun testingfor(x : Float64*)
end