Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

How to set Build order in Visual Studio

brianreinhold
Novice
603 Views

I have a case where a module GSUBS contains functions that depend upon the module PBOX.

  • If I clean and rebuild, the build fails
    • If I build again, the build succeeds
  • If I clean and compile PBOX and build, the build succeeds

It's clear what the problem is in this very simple case. I need to build PBOX before I build GSUBS. However, unlike the C/C++ compilers, I am unable to specify the build order (or at least I could not find a way to do that). The only dependency option I had was to build another project first if this project depended upon that project (which is does not).

I see some VERY old posts on the issue (2011-2014) but did not find any solutions. 

PBOX contains win32 graphics calls and GSUBS is 'pure fortran' code that calls the graphics methods in PBOX. At the moment GSUBS contains two simple functions. All worked fine until I added the module GSUBS.   GSUBS looks like

module GSUBSModule
    use PboxModule

    implicit none
    private
    public :: BOX, MCURSOR
    
    contains
      (At the moment only two functions)
    !*************************************************Make BOX of lines:
	    function BOX(IX1, IY11, IX2, IY22, color, hWnd) result(message)
            use ifwinty
    
	        INTEGER(SINT), intent(in) :: IX1, IY11, IX2, IY22
            INTEGER*4, intent(in) :: color
            INTEGER(HANDLE), INTENT(IN) :: hWnd
    
	        INTEGER(SINT) IY1, IY2
            character(128) :: message    
    
	        IY1 = gWndHght - IY11
	        IY2 = gWndHght - IY22
    
	        message = PLINE(IX1, IY1, IX1, IY2, color, hwnd)
	        message = PLINE(IX1, IY2, IX2, IY2, color, hwnd)
	        message = PLINE(IX2, IY2, IX2, IY1, color, hwnd)
	        message = PLINE(IX2, IY1, IX1, IY1, color, hwnd)
        END function BOX
    
    !*********************************************Mouse cursor drawing routine:
        function MCURSOR(IX, IYY, color, hWnd) result(message)
            use ifwinty
    
	        INTEGER(SINT), intent(in) :: IX, IYY
            INTEGER*4, intent(in) :: color
            INTEGER(HANDLE), INTENT(IN) :: hWnd
    
	        INTEGER(SINT) :: I, IX2, IY2, IY
            character(128) :: message
    
	        IY = gWndHght - IYY
	        IX2 = IX - 8
	        IY2 = IY - 8
	        DO I = 1, 17
	           message = PLOT(INT(IX2 + I, SINT), IY, color, hwnd)
	           message = PLOT(IX2 + I, IY + 1, color, hwnd)
	           message = PLOT(IX + 1, IY2 + I, color, hwnd)
	           message = PLOT(IX, IY2 + I, color, hwnd)
            END DO
        END function MCURSOR
0 Kudos
1 Reply
andrew_4619
Honored Contributor III
566 Views

Vs is good at getting dependencies correct. The symptoms sound like circular depandancies. A depends on B and B depends On A so the correct order is Impossible. You need to change the structure or look at submodules. Does pboxmodule call mcursor or box if so that is circular.

0 Kudos
Reply