Hi,
I imported following COM interface
DECLARE_INTERFA CE(IAxMediaCB)
{
STDMETHOD(Buffe rCB)
(
LONGLONG theStartTime,
BYTE * theDstBuffer,
long theSize
) PURE;
};
to managed code:
public interface IAxMediaCB
{
int BufferCB(long theStartTime, IntPtr theDstBuffer, int
theSize);
}
Is there any way to declare in .NET that interface method BufferCB has
a __cdecl calling convention? I know there is
UnmanagedFuncti onPointerAttrib ute, but this can be only applied on
the delegate. I need somethig similar, but destination should be a
method. Is there any way to do it? 2 2414
On Aug 15, 11:15*am, Builder <peter.gej...@g mail.comwrote:
Hi,
I imported following COM interface
DECLARE_INTERFA CE(IAxMediaCB)
{
* STDMETHOD(Buffe rCB)
* * (
* * LONGLONG *theStartTime,
* * BYTE * theDstBuffer,
* * long *theSize
* * ) PURE;
};
to managed code:
* * public interface IAxMediaCB
* * {
* * * * int BufferCB(long theStartTime, IntPtr theDstBuffer, int
theSize);
* * }
Is there any way to declare in .NET that interface method BufferCB has
a __cdecl calling convention?
Actually, given your C declaration, the method is not cdecl; it's
stdcall. Which means that .NET COM interop should just work. You will
still need MethodImplAttri bute on method declarations, though - import
some random COM component into your .NET application, and look at the
generated assembly in ildasm to see what it would look like.
>You will still need MethodImplAttri bute on method declarations, though - import some random COM component into your .NET application, and look at the generated assembly in ildasm to see what it would look like.
That's not necessary, but he will need to add the ComImport, Guid and
InterfaceType attributes to the interface itself.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lenard Lindstrom |
last post by:
I was wondering if anyone has suggested having Python determine
a method's kind from its first parameter. 'self' is a de facto
reserved word; 'cls' is a good indicator of a class method
( __new__ is a special case ). The closest to this I could find
was the 2002-12-04 posting 'metaclasses and static methods'
by Michele Simionato. The posting's example metaclass uses the
method's name. I present my own example of automatic method
kind...
|
by: Asapi |
last post by:
1. Are linkage convention and calling convention referring to the same
thing?
2. Does calling convention differ between languages C and C++?
3. How does calling convention differ between static and non-static class
member function?
4. Could it be possible to specify different calling convention for each
"global" or each class member function? Even in a single file scope?
|
by: Muthu |
last post by:
I've read calling conventions to be the order(reverse or forward) in
which the parameters are being read & understood by compilers.
For ex. the following function.
int Add(int p1, int p2, int p3);
The parameters here can be read either in the forward order from p1
till p3 or reverse order from p3 till p1.
Can anyone explain what is the advantage/disadvantage of either of
|
by: Ole Hanson |
last post by:
I am accessing my database through an interface, to allow future
substitution of the physical datastore - hence I would like to declare in my
Interface that my DAL-objects implementing the interface and accessing the
datastore MUST pass in a UserToken in the constructor of the object.
Is this not possible?
Am I forced to add the UserToken as a property on the object instead?
/Ole
|
by: Daniel Mori |
last post by:
If an object implements the IDisposable interface (regardless if its a
framework object or a user object), should I always dispose of that
object out of principle?
| |
by: ~~~ .NET Ed ~~~ |
last post by:
Yes, I think so at least... In C# you *can* have static properties which are
quite useful when used properly. Now imagine the scenario where you need the
ability (sp?) to implement a variety of classes that must implement an
interface. All these classes must have a particular *static* property, and
this in particular is handy not only to be consequent with the fact that you
can do it with classes but also with the fact that you cannot...
|
by: noony |
last post by:
Here is the error I get after calling a method (described below) :
Run-Time Check Failure #0 - 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.
This is the code (simplified), the crash happend on line 49. I give some explainations after.
...
|
by: sulekhasweety |
last post by:
Hi,
the following is the definition for calling convention ,which I have
seen in a text book, can anyone give a more detailed explanation in
terms of ANSI - C
"the requirements that a programming system places on how a procedure
is called and how data is passed between a calling program and
procedures are called calling conventions"
|
by: Jaco Naude |
last post by:
Hi there,
This is my first post over here and I hope someone can give me some
guidance.
I'm trying to embed Python into a Visual C++ 2008 application and I'm
getting linker problems. I've compiled a DLL of the Python source code
using the pythoncode VC++ project in the PCbuild folder of the source
download and this works 100% without any warnings etc. I've done this
in Debug and Release mode without any problems.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |