-
Notifications
You must be signed in to change notification settings - Fork 108
Fix executables linking #743
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <sys/stat.h> | ||
/* | ||
* Decides whether a given file name is a directory. | ||
* return 1 if file exists and is a directory | ||
* Source (Public domain): https://github.com/urbanjost/M_system | ||
*/ | ||
int my_isdir(const char *path) | ||
{ | ||
struct stat sb; | ||
return stat(path, &sb) == 0 && S_ISDIR(sb.st_mode); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module with_c | ||
use iso_c_binding, only: c_char, c_int, c_null_char | ||
implicit none | ||
|
||
contains | ||
|
||
function system_isdir(dirname) | ||
! Source (Public domain): https://github.com/urbanjost/M_system | ||
! | ||
implicit none | ||
character(len=*), intent(in) :: dirname | ||
logical :: system_isdir | ||
|
||
interface | ||
function c_isdir(dirname) bind(C, name="my_isdir") result(c_ierr) | ||
import c_char, c_int | ||
character(kind=c_char, len=1), intent(in) :: dirname(*) | ||
integer(kind=c_int) :: c_ierr | ||
end function c_isdir | ||
end interface | ||
|
||
system_isdir = c_isdir(trim(dirname)//c_null_char) == 1 | ||
|
||
end function system_isdir | ||
|
||
end module with_c | ||
|
||
program with_c_app | ||
use with_c | ||
implicit none | ||
|
||
write (*, *) "isdir('app') = ", system_isdir('app') | ||
write (*, *) "isdir('src') = ", system_isdir('src') | ||
write (*, *) "isdir('test') = ", system_isdir('test') | ||
write (*, *) "isdir('bench') = ", system_isdir('bench') | ||
|
||
end program with_c_app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name = "with_c" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
submodule(parent) child1 | ||
implicit none | ||
|
||
interface | ||
module function my_fun() result (b) | ||
integer :: b | ||
end function my_fun | ||
end interface | ||
|
||
contains | ||
|
||
module procedure my_sub1 | ||
a = my_fun() | ||
end procedure my_sub1 | ||
|
||
end submodule child1 |
10 changes: 10 additions & 0 deletions
10
example_packages/app_with_submodule/app/app1/grandchild.f90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
submodule(parent:child1) grandchild | ||
implicit none | ||
|
||
contains | ||
|
||
module procedure my_fun | ||
b = 1 | ||
end procedure my_fun | ||
|
||
end submodule grandchild |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
program test | ||
use parent | ||
implicit none | ||
|
||
integer :: a | ||
|
||
call my_sub1(a) | ||
|
||
if (a /= 1) then | ||
write(*,*) 'FAILED: Unexpected value of a' | ||
stop 1 | ||
end if | ||
|
||
end program test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
submodule(parent) child2 | ||
implicit none | ||
|
||
contains | ||
|
||
module procedure my_sub1 | ||
a = 2 | ||
end procedure my_sub1 | ||
|
||
end submodule child2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
program test | ||
use parent | ||
implicit none | ||
|
||
integer :: a | ||
|
||
call my_sub1(a) | ||
|
||
if (a /= 2) then | ||
write(*,*) 'FAILED: Unexpected value of a' | ||
stop 1 | ||
end if | ||
|
||
end program test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name = "app_with_submodule" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module parent | ||
implicit none | ||
|
||
interface | ||
|
||
module subroutine my_sub1(a) | ||
integer, intent(out) :: a | ||
end subroutine my_sub1 | ||
end interface | ||
|
||
end module parent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.