473,796 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to write Marshalling code for Function pointer in cpp?

Hi,

Can anyone help me about how to write Marshalling code for Function
pointer in cpp?

Thanks
Abhijit

Nov 8 '06 #1
3 1731
>Can anyone help me about how to write Marshalling code for Function
>pointer in cpp?
What kind of marshaling? Maybe you should post to the C++ group
instead.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 8 '06 #2
Hi Matt,

Sorry for confusing you. I will like to elaborate more on this.

I have one VC++ method/function
DataRecvdOnCall Back(unsigned char * buffer, int *
size)

I need to use this callback method from C# space.For
this purpose I am planning to write one delegate

public delegate void DataRecvdCallBa ckDelegate(ref
byte[] buffer,ref int size);

can anyone tell me how to write
Interoperabilit y/marshalling wrapper for it?

Thanks
Abhijit
Mattias Sjögren wrote:
Can anyone help me about how to write Marshalling code for Function
pointer in cpp?

What kind of marshaling? Maybe you should post to the C++ group
instead.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 9 '06 #3
No reply:-(

Waiting for reply!
Abhijit
ku**********@gm ail.com wrote:
Hi Matt,

Sorry for confusing you. I will like to elaborate more on this.

I have one VC++ method/function
DataRecvdOnCall Back(unsigned char * buffer, int *
size)

I need to use this callback method from C# space.For
this purpose I am planning to write one delegate

public delegate void DataRecvdCallBa ckDelegate(ref
byte[] buffer,ref int size);

can anyone tell me how to write
Interoperabilit y/marshalling wrapper for it?

Thanks
Abhijit
Mattias Sjögren wrote:
>Can anyone help me about how to write Marshalling code for Function
>pointer in cpp?
What kind of marshaling? Maybe you should post to the C++ group
instead.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 11 '06 #4

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

Similar topics

4
2867
by: Animesh | last post by:
Hi All, I don't know whethher this is possible or not. This is the result of a bad design problem. Here I go; I have a structure like this: typedef struct _s_index_entry { char *doc_id; double s_id;
4
10683
by: TT (Tom Tempelaere) | last post by:
Hi people I am wrapping a C dll using PInvoke from C#. I need to wrap the following signature in C int dma_start( const UCHAR* data, UINT data_length ) The function should start with a DMA operation, and I have to use it from my C# program. I am really unsure what type of marshalling I should use. The data parameter is a pointer to an array of byte data. This data must not be copied when calling the function. Plus, the .NET...
2
1932
by: Jason Bell | last post by:
I know this functionality already exists in .NET 2.0 via Marshal.GetDelegateForFunctionPointer, but I'd rather not force my users to use a beta framework (not to mention the fact that I'm still using good old vs .net 2002, that refuses to use the 2.0 framework). Specifically, I'm using an external declaration of the Simple Directmedia Library function SDL_GL_GetProcAddress to acquire the procedure addresses of OpenGL extensions. ...
1
2702
by: Reynardine | last post by:
I am calling a C/C++ DLL from C# and I am marshalling the parameters to the API call by doing a type conversion for each parameter. For example, here is my C++ API method : short int XENO_API XcDatabaseCodes ( HWND hwnd, char FAR * pszDatabase, char FAR * HUGE * FAR * pszItemCategories
2
1290
by: BartMan | last post by:
Greetings, When working with managed c++, do you have to do anything special when going from simple types from managed to unmanaged and vice versa. Or is marshalling handled automatically for you? I have seen from several posts that you have to do special conversions for strings, but what about the other types such as int, long,ect. In my case I want to save it as a member variable from a managed class into an unmanaged class's.
5
2890
by: PickwickBob3 | last post by:
I am trying to obtain a list of HID devices and am trying to use UINT GetRawInputDeviceList( PRAWINPUTDEVICELIST pRawInputDeviceList, PUINT puiNumDevices, UINT cbSize); a USER32.dll. but the function fails. Here is the code. I am new to Marshalling. Can anyone suggest my error and why? I am using C# with Visual Studio 2003 with 1.1 .NET Code: /*typedef struct tagRAWINPUTDEVICELIST { HANDLE hDevice; DWORD dwType;
1
2563
by: Beorne | last post by:
I have a cpp application with this structure: //////////////C++/////////////// typedef struct StatusStructure { char FixedLenString; long LongVariable; double DoubleVariable; BOOL BoolVariable; } StatusStructure;
2
3353
by: calenlas | last post by:
Hi all, I'm taking my first steps into C# <--C++ DLL Interop and unfortunately I've run into (what seems to be) a very complicated case as my first task. Perhaps someone here can help me. I need to pass an array of RADIO_INFO2 structures to be filled by a function in the DLL. This is how the structure is defined in the C++ example that comes with the DLL:
2
2151
by: d-42 | last post by:
Hi, I'm pretty sure I've just got a Marshalling problem, but I'm completely stumped. If there is a better newsgroup to post this in, please point me towards it. First I'm trying to use SendMessage() with WM_COPYDATA to send a string data between two instances of a program. As part of the debugging I've written two methods one where a given instance will obtain its own hWnd and send itself the message, one where it accepts
0
9683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9529
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,...
0
10457
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10231
jinu1996
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...
1
10176
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,...
0
10013
tracyyun
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...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2927
bsmnconsultancy
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...

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.