Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

calling C, Error spawning cl.exe

blaise_faugeras
Beginner
659 Views
Hello,
I am using CVF under windows XP. I need to call C functions in my fortran code. As mentioned in the users guide I use the declaration (for eg)
EXTERNAL pushreal8array_
!DEC$ ATTRIBUTES C,REFERENCE :: pushreal8array_
in the fortran subroutine pushreal8 which calls the C function pushreal8array.
CVF gives me the following error message:
--------------------Configuration: modele - Win32 Debug--------------------
Compiling...
Error spawning cl.exe
Does anybody know what to do? I can't figure it out.
I haven't got any C compiler, is this a problem?
Thank you,
Yours sincerely
B. Faugeras
Hereis an exempleof the fortran routine and the C function:
cccccccccccccccccccccccccccccccccccccccccccccccccccc
SUBROUTINE PUSHREAL8(x)
EXTERNAL pushreal8array_
!DEC$ ATTRIBUTES C,REFERENCE :: pushreal8array_

REAL*8 x, adr8buf(512), adr8lbuf(512)
INTEGER adr8ibuf,adr8ilbuf
LOGICAL adr8inlbuf
COMMON /adr8fbuf/adr8buf,adr8lbuf,
+ adr8ibuf,adr8ilbuf,adr8inlbuf
DATA adr8ibuf/1/
DATA adr8ilbuf/-1/
DATA adr8inlbuf/.FALSE./
c
IF (adr8ilbuf.ne.-1) THEN
adr8ilbuf = -1
adr8inlbuf = .FALSE.
ENDIF
IF (adr8ibuf.ge.512) THEN
adr8buf(512) = x
CALL pushreal8array(adr8buf, 512)
adr8ibuf = 1
ELSE
adr8buf(adr8ibuf) = x
adr8ibuf = adr8ibuf+1
ENDIF
END
cccccccccccccccccccccccccccccccccccccccccccccccc
static char adSid[]="$Id: adStack.c,v 1.5 10/.1/.1 .1:.3:.0 llh Exp $";
#include
#define ONE_BLOCK_SIZE 16384
#define CHUNK_SIZE 4096
/* The main stack is a double-chain of DoubleChainedBlock objects.
* Each DoubleChainedBlock holds an array[ONE_BLOCK_SIZE] of char. */
typedef struct _doubleChainedBlock{
struct _doubleChainedBlock *prev ;
char *contents ;
struct _doubleChainedBlock *next ;
} DoubleChainedBlock ;
/* Globals that define the current position in the stack: */
static DoubleChainedBlock *curStack = NULL ;
static char *curStackTop = NULL ;
/* Globals that define the current LOOKing position in the stack: */
static DoubleChainedBlock *lookStack = NULL ;
static char *lookStackTop = NULL ;
/* PUSHes "nbChars" consecutive chars from a location starting at address "x".
* Resets the LOOKing position if it was active.
* Checks that there is enough space left to hold "nbChars" chars.
* Otherwise, allocates the necessary space. */
void pushNarray(char *x, int nbChars) {
int nbmax = (curStack)?ONE_BLOCK_SIZE-(curStackTop-(curStack->contents)):0 ;
lookStack = NULL ;
if (nbChars <= nbmax) {
memcpy(curStackTop,x,nbChars);
curStackTop+=nbChars ;
} else {
char *inx = x+(nbChars-nbmax) ;
if (nbmax>0) memcpy(curStackTop,inx,nbmax) ;
while (inx>x) {
/* Create new block: */
if ((curStack == NULL) || (curStack->next == NULL)) {
DoubleChainedBlo ck *newStack ;
char *contents = (char*)malloc(ONE_BLOCK_SIZE*sizeof(char)) ;
newStack = (DoubleChainedBlock*)malloc(sizeof(DoubleChainedBlock)) ;
if ((contents == NULL) || (newStack == NULL)) {
DoubleChainedBlock *stack = curStack ;
int nbBlocks = 0 ;
while(stack) {
stack = stack->prev ;
nbBlocks++ ;
}
printf("Out of memory (allocated %i blocks of %i bytes) ",
nbBlocks, ONE_BLOCK_SIZE) ;
exit(0);
}
if (curStack != NULL) curStack->next = newStack ;
newStack->prev = curStack ;
newStack->next = NULL ;
newStack->contents = contents ;
curStack = newStack ;
} else
curStack = curStack->next ;
/* new block created! */
inx -= ONE_BLOCK_SIZE ;
if(inx>x)
memcpy(curStack->contents,inx,ONE_BLOCK_SIZE) ;
else {
int nbhead = (inx-x)+ONE_BLOCK_SIZE ;
curStackTop = curStack->contents ;
memcpy(curStackTop,x,nbhead) ;
curStackTop += nbhead ;
}
}
}
}
/* POPs "nbChars" consecutive chars to a location starting at address "x".
* Resets the LOOKing position if it was active.
* Checks that there is enough data to fill "nbChars" chars.
* Otherwise, pops as many blocks as necessary. */
void popNarray(char *x, int nbChars) {
int nbmax = curStackTop-(curStack->contents) ;
lookStack = NULL ;
if (nbChars <= nbmax) {
curStackTop-=nbChars ;
memcpy(x,curStackTop,nbChars);
} else {
char *tlx = x+nbChars ;
if (nbmax>0) memcpy(x,curStack->contents,nbmax) ;
x+=nbmax ;
while (x curStack = curStack->prev ;
if (x+ONE_BLOCK_SIZEmemcpy(x,curStack->contents,ONE_BLOCK_SIZE) ;
x += ONE_BLOCK_SIZE ;
} else {
int nbtail = tlx-x ;
curStackTop=(curStack->contents)+ONE_BLOCK_SIZE-nbtail ;
memcpy(x,curStackTop,nbtail) ;
x = tlx ;
}
}
}
}
/* LOOKs "nbChars" consecutive chars to a location starting at address "x".
* Activates the LOOKing position if it was reset.
* LOOKing is just like POPping, except that the main pointer
* remains in place, so that the value is not POPped.
* Further PUSHs or POPs will start from the same place as if
* no LOOK had been made. */
void lookNarray(char *x, int nbChars) {
int nbmax ;
if (lookStack == NULL) {
lookStack = curStack ;
lookStackTop = curStackTop ;
}
nbmax = lookStackTop-(lookStack->contents) ;
if (nbChars <= nbmax) {
lookStackTop-=nbChars ;
memcpy(x,lookStackTop,nbChars);
} else {
char *tlx = x+nbChars ;
if (nbmax>0) memcpy(x,lookStack->contents,nbmax) ;
x+=nbmax ;
while (x lookStack = lookStack->prev ;
if (x+ONE_BLOCK_SIZEmemcpy(x,lookStack->contents,ONE_BLOCK_SIZE) ;
x += ONE_BLOCK_SIZE ;
} else {
int nbtail = tlx-x ;
lookStackTop=(lookStack->contents)+ONE_BLOCK_SIZE-nbtail ;
memcpy(x,lookStackTop,nbtail) ;
x = tlx ;
}
}
}
}
/****** Exported PUSH/POP/LOOK functions for ARRAYS: ******/
void pushreal8array_(char *x, int *n) {
pushNarray(x,(*n*8)) ;
}
0 Kudos
1 Reply
Intel_C_Intel
Employee
659 Views
It is better to ask this question on Intel Compiler forum.
Regards,
Vladimir
0 Kudos
Reply