c#


Can anyone find equivalent c# code


i need equivalent c# code
VssSdkClientId VSS_SDK_SPEC startVssSdkClientEcho(const VssSdkXChar *host,
const VssSdkPort port,
NotifyFunc &notifyFunc,
const eProtocolType protocolType,
bool doIcmpEchoRequest = true );
this is my c++ SDK code .... here i need to import this interface and need to perform some operation
[DllImport("VssSdkd")]
public static extern void startVssSdkClientEcho(StringBuilder IpAddress, long port, ? ,eProtocolType proType, bool Req);
NotifyFunc &notifyFunc -> here i need to implemet the some callback function it should call the function like
myNotifyFunc( enumType notificationType, void *data)
{
}
in c# "void *data" is not avalable how can achive this... hepl me guys... thanks in advance
For a call back function you can pass in a reference to a delegate and P/Invoke will marshal the callback to your delegate. See the this example.
For the void* parameter that would be best translated to an IntPtr which is always the same size as a pointer. If you need to retrieve the data from that pointer you can use one of the methods in System.Runtime.InteropServices.Marshal.
So for your example:
public delegate void NotifyFunc(enumType notificationType, IntPtr data);
[DllImport("VssSdkd")]
public static extern void startVssSdkClientEcho(string IpAddress,
long port, NotifyFunc notifyFunc, eProtocolType proType, bool Req);
Note that IpAddress can be a string. It would only have to be a StringBuilder if the calling code modified it and passed it back. Since the C++ prototype lists it as a const char*, it won't be changing the string.
I'm no expert when it comes to C++ interop, so I can't answer your question directly. However, I suggest you have a look at pinvoke.net. There are lots of examples of the correct way to use the Windows API from managed code. That may be enough information to help you figure out what would be appropriate for your function.

Related Links

How to display the result in another form?
how can i search or locate an address on google map using xamarin?
SHA256 Base64 Hash in Ruby
Running cmd programaticly only returns some outputs [duplicate]
.NET Print Area and PageBreak
How to attach a database to a setup
Messaging PlugIn (Carel Lotz) in Xamarin PCL?
how to change OrderBy direction of IQueryable
Faster alternative to SelectedOption to retrieve selected item on drop down menu?
VPN for concrete domains?
Why are dumped IL files smaller than .exe files?
Programmatically add buttons to a UWP app
Unity Button not shooting projectile properly
XML Deserialization is not working
dotnet core autofac and json configuration can they all work together in a console app
Entity framework - Fill multiple object with list from database without foreach every objects

Categories

HOME
optimization
customization
mysqli
highmaps
conceptual
where
mailchimp
angularjs-directive
browser-cache
powerquery
uml-designer
atlassian-fisheye
sitemap
doctrine2
vsixmanifest
token
soap-client
repeater
jquery-easyui
hapijs
orange
aws-devicefarm
spring-webflow
android-navigation-drawer
inline-assembly
sha
android-xml
android-cursorloader
utc
kundera
jbossfuse
r-factor
boost-log
urhosharp
contextmenustrip
circle
ports
wunderground
certbot
motherboard
gstreamer-1.0
lighting
susy
redbean
jvisualvm
binary-decision-diagram
colorbox
firefox-developer-edition
ack
ionic2-select
history
r-commander
hellosign
wicketstuff
cardview
stripes
optional-parameters
mongodb-3.3
disconnect
sprockets
db2-zos
django-celery
boost-propertytree
pyshark
jsondoc
javapackager
persian
android-togglebutton
page-flipping
first-order-logic
jsoncpp
joomla3.3
eaaccessory
eggplant
photogrammetry
stderr
ultraedit
conkeror
crtdbg.h
xcode5
drools-guvnor
novell
redmine-plugins
javacompiler
mvcgrid
pyalgotrade
sqldatasource
fastcgi-mono-server
pthreads-win32
adabas
code-complete
google-mirror-api
octokit
playing-cards
auctex
database-restore
erlide
unordered-set
capitalization
jexcelapi
netbeans7.0
fxcopcmd
text-manipulation
chromebug
qprocess
atmega16

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App