how to call vc6 dll from vc2005

G

Guest

Thanks in advance. I have a vc6 dll that is currently called by a vc6 exe
and want to call it from a vc2005 dll. The vc6 exe using the following header

[DllImport("cMath.lib")]
extern "C" __declspec(dllimport) int Estimate (int Task2Do,...);

Can someone please point me in the right direction for calling this function
from vc2005? Also, is it possible to expose the vc6 class and use that
directly?
 
G

Guest

....using this in the vc2005 dll
__declspec( dllimport ) int Estimate (
int Task2Do, int EstimateID, char dsn[], char UID[], char PWD[],
float pIn, float pOut, int iPrint, int DosWindow,
int m1, int d1, int y1, int m2,int d2, int y2,
char dteTS[], float AOV[],
float Actual[], float Predicted[], float Residual[]);
I get this error:
Linking...
Estimator_BLL.obj : error LNK2020: unresolved token (0A000009)
"int __cdecl Estimate(int,int,char * const,char * const,
char*const,float,float,int,int,int,int,int,int,int,int,char *
const,float * const,
float* const,float * const,float * const)"
(?Estimate@@$$FYAHHHQAD00MMHHHHHHHH0QAM111@Z)
Estimator_BLL.obj : error LNK2001: unresolved external symbol
"int __cdecl Estimate(int,int,char * const,char * const,
char * const,float,float,int,int,int,int,int,int,int,int,
char * const,float * const,float * const,float * const,float * const)"
(?Estimate@@$$FYAHHHQAD00MMHHHHHHHH0QAM111@Z)
C:\Code\Estimator\Estimator_GUI\Debug\Estimator_BLL.dll :
fatal error LNK1120: 2 unresolved externals
I have cMath.lib and cMath.dll in c:\windows\System32
 
G

Guest

.... some additional information on the problem.
It seems that vc2005
1) will not read a simple __cdecl export and
2) is adding to the mangled name under a __stdcall export

from DumpBin on cMath.lib
?Estimate@@YGJJJQAD00MMJJJJJJJJ0QAM111@Z (long __stdcall Estimate (...
?LiZhou1@@YGHXZ (int __stdcall LiZhou1(void))

from C++2005 Error
(?Estimate@@$$J280YGHHHQAD00MMHHHHHHHH0QAM111@Z)
(?LiZhou1@@$$J10YGHXZ)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top