georgecr
December 15th, 2005, 03:18 PM
Hello,
I have a problem with importing the function of my win32 DLL to my .NET project.
After fixing up the FILETIME error I was able to import 1 function and use it successfuly in my program.
But when I try to import the next one I get some errors I cannot fix and it seems that it doesn't matter which function I try to import first, but the second import will always give those errors.
Here's the code in my dll wrapper class:
using namespace System;
using namespace System:: Runtime;
// First create a namespace to put all calls to unmanaged library DLLs in one place
namespace ScoringLibrary
{
[
InteropServices:: DllImportAttribute(
"c:\\temp\\Scoring.dll",
EntryPoint="CalcLevel",
InteropServices:: DllImportAttribute:: CallingConvention=
InteropServices:: DllImportAttribute::CallingConvention::Winapi
)
]
int CalcLevel(int currLevel, int currScore);
[
InteropServices:: DllImportAttribute( //line 27
"c:\\temp\\Scoring.dll",
EntryPoint="CalcScore",
InteropServices:: DllImportAttribute:: CallingConvention=
InteropServices:: DllImportAttribute:: CallingConvention:: Winapi
)
]
int CalcScore(int oldScore,int oldLevel,int bonus); //line 34
}
the 2 errors:
c:\temp\Tetris\DLLWrapper.h(34): error C2363: cannot evaluate argument '"InteropServices:: DllImportAttribute:: CallingConvention"="InteropServices:: DllImportAttribute::CallingConvention:: Winapi"' of custom attribute 'System:: Runtime:: InteropServices:: DllImportAttribute'
c:\temp\Tetris\DLLWrapper.h(27): error C3725: 'System:: RuntimeS:: InteropServices:: DllImportAttribute': cannot resolve attribute overload
can anyone help?
thanks
I have a problem with importing the function of my win32 DLL to my .NET project.
After fixing up the FILETIME error I was able to import 1 function and use it successfuly in my program.
But when I try to import the next one I get some errors I cannot fix and it seems that it doesn't matter which function I try to import first, but the second import will always give those errors.
Here's the code in my dll wrapper class:
using namespace System;
using namespace System:: Runtime;
// First create a namespace to put all calls to unmanaged library DLLs in one place
namespace ScoringLibrary
{
[
InteropServices:: DllImportAttribute(
"c:\\temp\\Scoring.dll",
EntryPoint="CalcLevel",
InteropServices:: DllImportAttribute:: CallingConvention=
InteropServices:: DllImportAttribute::CallingConvention::Winapi
)
]
int CalcLevel(int currLevel, int currScore);
[
InteropServices:: DllImportAttribute( //line 27
"c:\\temp\\Scoring.dll",
EntryPoint="CalcScore",
InteropServices:: DllImportAttribute:: CallingConvention=
InteropServices:: DllImportAttribute:: CallingConvention:: Winapi
)
]
int CalcScore(int oldScore,int oldLevel,int bonus); //line 34
}
the 2 errors:
c:\temp\Tetris\DLLWrapper.h(34): error C2363: cannot evaluate argument '"InteropServices:: DllImportAttribute:: CallingConvention"="InteropServices:: DllImportAttribute::CallingConvention:: Winapi"' of custom attribute 'System:: Runtime:: InteropServices:: DllImportAttribute'
c:\temp\Tetris\DLLWrapper.h(27): error C3725: 'System:: RuntimeS:: InteropServices:: DllImportAttribute': cannot resolve attribute overload
can anyone help?
thanks