473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Interfacing with Vendor DLL, Delegates

1. my vendor interface is defined in an h & c file:

_EXTERN S16BIT _DECL aceSetIrqConditions(S16BIT DevNum, U16BIT bEnable,
U32BIT dwIrqMask,void(_DECL *funcExternalIsr)(S16BIT DevNum, U32BIT
dwIrqStatus))

void _DECL Callback(S16BIT DevNum, U32BIT dwIrqStatus);

/* Configure user callback ISR and enable EOM interrupts */
aceSetIrqConditions(DevNum, TRUE, ACE_IMR1_BC_MSG_EOM, Callback);

void _DECL Callback(S16BIT DevNum, U32BIT dwIrqStatus)
{
/* this is what I would write, I would like to get here with C#
}

2. I am trying to use the vendor interface for the above
aceSetIrqConditions() to call an interrup routine I write (eomInterrupt).
This is my C# effort, it compiles, but when I try to execute this, I get an
Error, see below:

// EOM Interrupt declaration
public delegate void Callback(short DevNum, uint dwIrqStatus);

[DllImport("C:\\acs\\bin\\Release\\emace_32.dll")]
public extern static short aceSetIrqConditions(short DevNum, ushort bEnable,
uint dwIrqMask, Callback cbm);

Callback cbm = new Callback(eomInterrupt);

aceSetIrqConditions(devNum, 1, ACS1553.ACE_IMR1_BC_MSG_EOM, cbm);

public void eomInterrupt(short DevNum, uint dwIrqStatus)
{
/* *** never gets to statement below! *** */
if((dwIrqStatus & ACS1553.ACE_IMR1_BC_MSG_EOM) != 0)
{
irqCount++;
}
}

The error is:
Debug Error!

File:i386\chkesp.c, Line 42.

The value of ESP was not properly saved across a function call. This is
usually a result of calling a function declared with one calling convention
with a function pointer declared with a different calling convention.

The program runs fine, except when I added above. What am I doing wrong???

Thanks,

--
Evelyne
Nov 16 '05 #1
0 1112

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jeffrey T. Smith | last post by:
Back when the new J2SE1.5 features were announced, there was a JavaLive community chat (http://java.sun.com/developer/community/chat/JavaLive/2003/jl0729.html) in which Neal Gafter explains the...
3
by: Sam | last post by:
I’m just starting to learn delegates. I’m at the very beginning. If I understand correctly, delegates are for when you want to pass a function as a parameter. For example the client provides a...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
4
by: AMDRIT | last post by:
I am trying to understand Delegates and where/when to use them. I can see one potential use of a delegate (on form closing, set the cancel property in the event arguments.) Does anyone have a...
6
by: =?Utf-8?B?Sko=?= | last post by:
I have a logger component that logs to multiple sources, ie textfile, eventlog etc. and I have two methods that depending on where I call up my logger comp. one of them will be called. For ex. if...
0
by: bharathreddy | last post by:
Delegates Here in this article I will explain about delegates in brief. Some important points about delegates. This article is meant to only those who already know delegates, it will be a quick...
6
by: =?Utf-8?B?T2xkQ2FEb2c=?= | last post by:
My question is regarding the use of delegates in C#. I see how .Net uses delegates to wire event handlers to events. It’s an object created by a single line of code by the system and that makes...
7
by: Siegfried Heintze | last post by:
I'm studying the book "Microsoft Visual Basic.NET Language Reference" and I would like some clarify the difference between events and delegates. On page 156 I see a WinForms example of timer that...
69
by: raylopez99 | last post by:
They usually don't teach you in most textbooks I've seen that delegates can be used to call class methods from classes that are 'unaware' of the delegate, so long as the class has the same...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.