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

enh: add support for c_funptr and c_funloc #4028

Merged
merged 4 commits into from
May 18, 2024
Merged

Conversation

Pranavchiku
Copy link
Contributor

@Pranavchiku Pranavchiku commented May 18, 2024

Fixes #3989. Fixes #3992. Fixes #3991.

With this PR we get the toy example compiled with LFortran

% lfortran -c libgompinterop.f90 && lfortran d.f90 -L/Users/pranavchiku/repos/llvm-project/openmp/build/runtime/src/ -lomp -Wl,-rpath,/Users/pranavchiku/repos/llvm-project/openmp/build/runtime/src/
Max threads:  8
Hello from thread  3
Hello from thread  1
Hello from thread  2
Hello from thread  0
Hello from thread  4
Hello from thread  6
Hello from thread  7
Hello from thread  5

@Pranavchiku Pranavchiku added the openmp Issue or pull request specific to openmp label May 18, 2024
@Pranavchiku
Copy link
Contributor Author

To test locally, assuming file names are c.f90 and c.cpp

lfortran -c c.f90 -o c.o
gcc -c c.cpp -o c_cpp.o
lfortran c.o c_cpp.o

@Pranavchiku Pranavchiku marked this pull request as ready for review May 18, 2024 07:05
Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this looks good, thanks for fixing it!

der_type_module->m_intrinsic &&
v_name == "c_funptr");
}
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and c_ptr must be later changed to be LFortran independent. For now since we already do this for c_ptr, it's fine.

@certik certik merged commit a477eee into lfortran:main May 18, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp Issue or pull request specific to openmp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for c_funloc compile toy openmp example add support for c_funptr
2 participants