PassionateDeveloper
PassionateDeveloper

Reputation: 15138

Convert a method from Java to C#

I have follow methods in Java:

public abstract int AMRecoveryModeDeviceSetAutoBoot(am_recovery_device paramam_recovery_device, byte paramByte);

public abstract int AMRecoveryModeDeviceReboot(am_recovery_device paramam_recovery_device);`

Both are imported from a DLL.

How to use it in C#.net?

I tried it with:

[DllImport(DLLPath, CallingConvention = CallingConvention.Cdecl)]
unsafe public extern static void AMRecoveryModeDeviceSetAutoBoot(AMRecoveryDevice device, byte paramByte);

It didn't throw an error, but nothing happens (the USB Device, a iPhone, should be restart, in the Java Application with these 2 lines it workes, here not.

Upvotes: 2

Views: 131

Answers (1)

diadem
diadem

Reputation: 854

There are many ways to do it. The way i like best is to use the extern keyword. This will allow you to create a wrapped class and simply reference the dll.

http://msdn.microsoft.com/en-us/library/e59b22c5(VS.80).aspx

Upvotes: 2

Related Questions