TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ashok Singh
NA
1
0
Calling C++ dll by using C# wrapper method , Exception occures
Mar 23 2010 11:52 AM
I am facing a problem while using the ITMSDLL.
The following is the C# code defined in my Application
public static string Get_Month_Mask(string theByt,int theMon, string theYr)
{
string aMByte = theByt;
int aSt_Dow, aEn_Dow, aSt_Wk, aEn_Wk;
DateTime aSDate = new DateTime(Convert.ToInt32(theYr),Convert.ToInt32(theMon),01);
DateTime aEDate = aSDate.AddMonths(1).AddDays(-1.0);
string aRetMask = "X".PadRight(120);
int aRc;
aSt_Dow = Utility.GetDayNumber(aSDate.DayOfWeek.ToString());
aEn_Dow = Utility.GetDayNumber(aEDate.DayOfWeek.ToString());
aSt_Wk = Utility.GetWeekOfTheYear(aSDate);
aEn_Wk = Utility.GetWeekOfTheYear(aEDate);
aRc = Utility.objCITMSDLL.GetMonthMask(out aRetMask,out aMByte, aSt_Dow, aSt_Wk, aEn_Dow, aEn_Wk);
return aRetMask.ToString();
}
And the below is the code used in ITMSDOTNETDLL where the wrapper method is written.
[
DllImport
(
"ITMSDLL.dll"
)]
internal
static
extern
int
get_month_mask(
out
string
theMask,
out
string
theByt,
int
theSt_Dow,
int
theSt_Week,
int
theEn_Dow,
int
theEn_Week);
public
int
GetMonthMask(
out
string
theMask,
out
string
theByt,
int
theSt_Dow,
int
theSt_Week,
int
theEn_Dow,
int
theEn_Week)
{
return
CITMSDLLMethods
.get_month_mask(
out
theMask,
out
theByt, theSt_Dow, theSt_Week, theEn_Dow, theEn_Week);
}
it throws error
The runtime has encountered a fatal error. The address of the error was at 0x79e71bd7, on thread 0xc94. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
if we use "ref" instead of "out" then it also throws same(above) error.
If anybody can help then please help me.
Reply
Answers (
0
)
Working with mail merge word document using VB.NET
Hardware detection,plug n unplug information at real time.