constant memory

I was trying to initialize constant memory in module like this:

module abc
integer, constant :: dd = 100
end module abc

but it seems that the value of dd is 0.

What’s happening?

Hi qijiin21c,

You need to set the constant in executable code.

Hope this helps,

Hi, Mat,

But what is a executable code? Is it convenient?

Thanks a lot?

By “executable” code, I mean code that’s executed in the program instead of statically initialized.

module abc 
integer, constant :: dd
end module abc 
program foo
use abc
dd = 100
end program foo

Hope that clarifies things,