473,386 Members | 1,796 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,386 software developers and data experts.

Help C#: how to call C++ dll function which is taking pointers as arguments in C#

9
Hi,

Please help me out in calling the the below C++ dll function in C#

the function definition in DLL is like this

short ncdGetDriverConfig (int *p, VDriverConfig* pDriverConfig);

where VDriverConfig is structure

Help me in importing this function in C#

Thanks in Advance
Sree
Oct 12 '07 #1
3 1782
in C# u can excute the function only which is comes from C++ right
so you have to pass parameters as values

ab() class in vc++
c = new ab()
c.add("1","2")
Oct 12 '07 #2
psree
9
I tried to Import the function in to C# using the below procedure

[DllImport("VCAND32.dll")]
public static extern short ncdGetDriverConfig(int p, VDriverConfig pDriverConfig);

but the actual definition of the function in the DLL is
short ncdGetDriverConfig(int* p , VDriverConfig* pDriverConfig);

so i getting conflict using that function

I even tried out using the reference

Thanks and regards
--Sree
Oct 12 '07 #3
Plater
7,872 Expert 4TB
You will probably have to use the IntPtr class and have code that is "unsafe" (check msdn for it's usage)
Oct 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jeff Greenberg | last post by:
Not an experienced c++ programmer here and I've gotten myself a bit stuck. I'm trying to implement a class lib and I've run into a sticky problem that I can't solve. I'd appreciate any help that I...
77
by: Eltee | last post by:
Hi everybody, Is it possible to 1. call a function from a dll made with .NET (C#) 2. from a program written in plain (as in: not .NET) C or C++? To be more specific, this is what I have. ...
26
by: Adam Warner | last post by:
Hello all, I'm very new to C but I have a number of years of Common Lisp programming experience. I'm trying to figure out ways of translating higher order concepts such as closures into C. The...
7
by: Alex | last post by:
Can anyone point me to any good online references about the va_arg() va_list() functions/macros I googled and found a couple of things, but what I found, failed to explain how it really works...
42
by: baumann | last post by:
hi all, typedef int (*pfunc)(int , int); pfunc a_func; i know it's ok, but how can define a_func without typedef statement? thanks .
22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
9
by: cmk128 | last post by:
Hi Why put * in front of the function name in the declaration? int (*write)(struct inode *, struct file *, const char *, int); thanks from Peter (cmk128@hotmail.com)
6
by: M Turo | last post by:
Hi, I was wondering if anyone can help. I'm want to pre-load a 'table' of function pointers that I can call using a its arrayed index, eg (non c code example) pFunc = func_A; pFunc = func_B;
18
by: mdh | last post by:
May I ask the following. By K&R's own admission, the example used to describe function pointers is complex ( on P119). In addition, the use of casts has been stated by some on this group as...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...

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.