# C Caller Block in Simulink does not show port specification?

#### TarikElec

Joined Oct 17, 2019
84
Hello,
as You can see C caller does not show Port specification of the c code of the MatLab video shown here:
C Call Block

Code:
           #ifndef HEADER_H_

// Global Variable

extern double gVec[5];
extern double sum;

//Function

#endif

source code as below:

Code:
#include "header.h"
double gVec[5];
double sum = 0;
int idx = 0, tmpSum = 0;

for(; idx < 5, ++idx){
tmpSum = tmpSum + gVec[idx);  // Function reads "gVec" as INPUT
}

sum = tmpSum; //Function writes to "sum" as OUTPUT

}

#### TarikElec

Joined Oct 17, 2019
84
Thanks I have not done this yet. let me do it and come back

#### click_here

Joined Sep 22, 2020
545
You also have an error here:
Code:
        tmpSum = tmpSum + gVec[idx);  // Function reads "gVec" as INPUT

// should be

tmpSum = tmpSum + gVec[idx];  // Function reads "gVec" as INPUT

#### TarikElec

Joined Oct 17, 2019
84
after checking the Global variables, I have only checked this and still the problem is there

#### Attachments

• 35.4 KB Views: 4

#### click_here

Joined Sep 22, 2020
545
after checking the Global variables, I have only checked this and still the problem is there
You'll need to go through the whole document on that link and make sure that you've done everything, as well as fixing that error I pointed out
C:
  tmpSum = tmpSum + gVec[idx);  // Function reads "gVec" as INPUT

// should be

tmpSum = tmpSum + gVec[idx];  // Function reads "gVec" as INPUT

#### TarikElec

Joined Oct 17, 2019
84
You'll need to go through the whole document on that link and make sure that you've done everything, as well as fixing that error I pointed out
C:
  tmpSum = tmpSum + gVec[idx);  // Function reads "gVec" as INPUT

// should be

tmpSum = tmpSum + gVec[idx];  // Function reads "gVec" as INPUT
I went through and nothing changed. I am upgrading my matlab license to 2020b and try.

#### click_here

Joined Sep 22, 2020
545
I went through and nothing changed. I am upgrading my matlab license to 2020b and try.
If that doesn't work and you've gone through all the instructions and are still having a problem I recommend going to the MATLAB specific forum