Skip to content

Commit

Permalink
BUG: Fix missing Header guard in C header.
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanSkocic committed Nov 30, 2023
1 parent 3ded39a commit 8f1a0b8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/codata.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @brief Codata module - autogenerated.
*/

#ifndef CODATA_H
#define CODATA_H
#if _MSC_VER
#define ADD_IMPORT __declspec(dllimport)
#else
Expand Down Expand Up @@ -1072,3 +1074,5 @@ ADD_IMPORT extern const double U_WIEN_WAVELENGTH_DISPLACEMENT_LAW_CONSTANT;/**<
ADD_IMPORT extern const double W_TO_Z_MASS_RATIO;/**< */
ADD_IMPORT extern const double U_W_TO_Z_MASS_RATIO;/**< */

#endif

12 changes: 12 additions & 0 deletions srcgen/c_code.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,24 @@ subroutine write_c_header_doc(fcode)
write(fcode, "(A) ") '* @brief Codata module - autogenerated.'
write(fcode, "(A)") "*/"
write(fcode, "(A)") ""
write(fcode, "(A)") '#ifndef CODATA_H'
write(fcode, "(A)") '#define CODATA_H'
write(fcode, "(A)") "#if _MSC_VER"
write(fcode, "(A)") "#define ADD_IMPORT __declspec(dllimport)"
write(fcode, "(A)") "#else"
write(fcode, "(A)") "#define ADD_IMPORT"
write(fcode, "(A)") "#endif"
end subroutine

subroutine write_C_header_end(fcode)
!! Generate the C header declaration
implicit none
! Arguments
integer(int32), intent(in) :: fcode
!! File unit of the C header.
write(fcode, "(A)") '#endif'
write(fcode, "(A)") ''
end subroutine


end module
2 changes: 2 additions & 0 deletions srcgen/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ program generator

print *, "Writing fortran module end..."
call write_fortran_module_end(ffortran)
print *, "Writing C header end..."
call write_C_header_end(fcheader)
print *, "Writing cpython end..."
call write_cpython_extension_end(fcpython);

Expand Down

0 comments on commit 8f1a0b8

Please sign in to comment.