Passing c arrays into fortran as a variable sized matrix

前端 未结 2 900
旧巷少年郎
旧巷少年郎 2021-01-19 15:19

So, i\'ve been commissioned to translate some fortran subroutines into C. These subroutines are being called as part of the control flow of a large porgram based primarily

2条回答
  •  星月不相逢
    2021-01-19 15:50

    What it shouldn't be that others suggested: 1. Size of int vs. size of Integer. Since the first column has the right values. 2. Row vs. column ordering. Would just get values in wrong order not segmentation faulted. 3. Reference vs value passing. Since the first column has the right values. Unless the compiler is doing something evil behind your back.

    Are you sure you don't do this in some secret way?:

       someCArray++
    

    print out the value of the someCArray pointer right after you make it and right before you pass it. You also should print it out using the debugger in the fortran code just to verify that the compiler is not generating some temporary copies to help you.

提交回复
热议问题