Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an option for an allocatable character variable #19

Open
tuncaen opened this issue Dec 7, 2022 · 3 comments
Open

Getting an option for an allocatable character variable #19

tuncaen opened this issue Dec 7, 2022 · 3 comments
Assignees

Comments

@tuncaen
Copy link

tuncaen commented Dec 7, 2022

When I try to get an option for an allocatable character variable, %get returns an empty string. If I change the character(:), allocatable :: cvar declaration to character(64) :: cvar, it works as it should be. Should allocatables be avoided or is there a solution to this issue?

program test
    use finer, only: file_ini
    use penf, only: i4p

    implicit none

    character(:), allocatable :: cvar
    type(file_ini) :: config 
    integer(i4p) :: error

    call config%load(filename="test.ini",error=error)

    if(error==0)then
        call config%get(section_name="workspace",option_name='id', val=cvar, error=error)
    end if

end program test

here cvar returned as undefined pointer/array where test.ini is as follow

[workspace]
    id = test_1207  ; title of the analysis
    ....
@szaghi
Copy link
Owner

szaghi commented Dec 7, 2022

Dear @tuncaen ,

thank you for pointing it out. Currently, allocatable val dummy arguments are not supported (not only character, but all other types must be a priori allocated. Supporting allocatable val arguments is not simple and for now I have not enough time to try to implement it, sorry.

Kind regards,
Stefano

@szaghi szaghi self-assigned this Dec 7, 2022
@tuncaen
Copy link
Author

tuncaen commented Dec 7, 2022

Dear @szaghi ,

Thank you for your quick reply. I follow your projects closely with admiration. Thank you for bringing all these functional libraries to the Fortran community.

@szaghi
Copy link
Owner

szaghi commented Dec 7, 2022

Dear @tuncaen ,

you are too kind!

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants