- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having linking errors trying to call a fortran subroutine from a c++ procedure. The MKL is called from procedures in the C++ part of the program and in the Fortran subroutine. The errors are all of this type.
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR90D.dll)
Theres one for each conflict between MSVCRTD.lib and MSVCR90D.dll
My suspicionis is I'vegot something configured wrong. (but I'll inlcude the code just in case. sorry if it clutters the board.)
I've tried setting Ignore All Default Libaries to Yes/(NODEFAULTLIB). The linker died on every call to new or Delete [] andall overmlk_core.lib.
The fortran subroutine is:
INCLUDE 'mkl_dfti.f90'
SUBROUTINE FLOWPASS(BUFFER, BUFLEN)
USE MKL_DFTI
IMPLICIT NONE
INTEGER, INTENT(IN) ::BUFLEN
REAL(8), DIMENSION(BUFLEN), INTENT(INOUT) :: BUFFER
INTEGER STATUS
INTEGER ERR
REAL(8) SCALE
TYPE(DFTI_DESCRIPTOR), POINTER :: HAND
COMPLEX(8), ALLOCATABLE :: X_IN(:)
COMPLEX(8), ALLOCATABLE :: X_OUT(:)
ALLOCATE(X_IN(BUFLEN), STAT = ERR)
ALLOCATE(X_OUT(BUFLEN),STAT = ERR)
X_IN = DCMPLX(BUFFER,0.0)
STATUS = DftiCreateDescriptor(HAND, DFTI_DOUBLE, &
DFTI_COMPLEX, 1, BUFLEN)
STATUS = DftiSetValue(HAND, DFTI_PLACEMENT, &
DFTI_NOT_INPLACE)
STATUS = DftiCommitDescriptor(HAND)
STATUS = DftiComputeForward(HAND, X_IN, X_OUT)
! HEREGOES FILTER
SCALE = 1.0/REAL(BUFLEN, KIND=8)
Status = DftiSetValue(HAND, DFTI_BACKWARD_SCALE, SCALE)
STATUS = DftiCommitDescriptor(HAND)
STATUS = DftiComputeBackward(HAND, X_OUT, X_IN)
BUFFER = DREAL(X_IN)
Status = DftiFreeDescriptor(HAND)
DEALLOCATE(X_IN)
DEALLOCATE(X_OUT)
RETURN
END
Defined Here:
#ifdef __cplusplus
extern "C"
#endif
void FLOWPASS(double* ppad_data, int& padlen);
Called from here:
#include "mathimf.h"
#include "uni_transformations.h"
#include "utility_procs.h"
void iuni_low_pass(double* pdata, int datalen, int lag, double* plp_ave)
{
double* pdt_data;
pdt_data = new double[datalen];
int padlen = 2 * lag + datalen;
double* ppad_data;
ppad_data = new double[padlen];
iuni_linear_detrend(pdata, datalen, pdt_data);
iuni_assign(ppad_data, 0.0, lag);
iuni_copy(pdt_data, ppad_data+lag, datalen);
iuni_assign(ppad_data+lag+datalen, 0.0, lag);
FLOWPASS(ppad_data, padlen);
iuni_copy(ppad_data, plp_ave, padlen);
delete [] pdt_data;
delete [] ppad_data;
pdt_data = 0;
ppad_data = 0;
}
Any helpwill be appreciated, even its just sending me to another board.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try that and see where it gets you. Be sure you have read Configuring for Mixed-Language Applications.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try that and see where it gets you. Be sure you have read Configuring for Mixed-Language Applications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That fixed it. Thank you.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page