Topic: C# DLL

Hi. I'm new here and i was wondering if you could make a dll in managed code so i can use it with C#.

I want something close to phidget's RFID API for .NET

Thanks for reading. Tagnard

Re: C# DLL

Dear Tagnard,

I don't see a problem. The sources are available, I would be happy to open a branch for any developer in the SVN repository that is willing to port this to c#. In the mean while, you can always use the current DLL in native-mode. But for manage code this quite sounds ugly wink

Cheers,

  Roel

Re: C# DLL

I will try and write it with the current DLL. But i need to have the reader that i have ordered.

Re: C# DLL

Great! It would be very nice to have a simple Managed C# wrapper for libnfc.dll
I suspect that there will be a lot developers interested in developing more GUI oriented products using C#
Let me know when you have something ready for committing into the repository, so others can help testing.

Re: C# DLL

i got my reader now and i have tried all day making thing work. but i failed.

I'm no good in C so if you want to make your DLL better, read this tutorial and implement it in the libnfc so i can access it from C#.

http://www.codeproject.com/KB/cs/usecdlllibincs.aspx

Re: C# DLL

Hey Tagnard,

Currently I'm working on version 1.1.0. It is almost done.
When I'm finished with that, I'll write a quick wrapper for ya to access it from C# wink

Cheers,

  Roel

Re: C# DLL

roel wrote:

Hey Tagnard,

Currently I'm working on version 1.1.0. It is almost done.
When I'm finished with that, I'll write a quick wrapper for ya to access it from C# wink

Cheers,

  Roel

I'm looking forward to it. I tried to pinvoke winscard.dll but it was harder than i thought.

Last edited by Tagnard (2009-03-24 12:36:18)

Re: C# DLL

I emailed you a pre-example wink

Re: C# DLL

roel wrote:

I emailed you a pre-example wink

I checked your example and it looks like a good base to use. but i run into problems.
i can not connect to my reader(touchtag). I have closed touchtag service and i have tested it on
windows 7 build 7077 and on windows xp with same result.

all i get is "Could not connect to a NFC device"

Last edited by Tagnard (2009-04-19 18:08:13)

Re: C# DLL

Hey,

Even on new firmware version it should work without a tag on top of it. But maybe you could try that?
Does the c (example) in the /win32/bin directory (command-line) "list" tool work?
Or does it gives the same result?

Thanks a lot in advance for testing.

Cheers,

  Roel

Re: C# DLL

When i use the list.exe from libnfc 1.1.0 i get
"Connected to NFC reader: ACR122U102"

So it works with the c code.

// Tagnard

Re: C# DLL

I don't understand, they work the same way. And if you use the list.exe with the DLL that was supplied by the .NET example, does it still work then?

Re: C# DLL

roel wrote:

I don't understand, they work the same way. And if you use the list.exe with the DLL that was supplied by the .NET example, does it still work then?

I tested both DLL's and they give me the same message.

Re: C# DLL

When i removed the try/catch statement i got an exception.

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

pdi = nfc_connect(); is throwing this exception

Hope this helps you

Last edited by Tagnard (2009-04-20 07:51:31)

Re: C# DLL

roel wrote:

I emailed you a pre-example wink

Can I have that example too?

I am badly in need of being able to use libnfc via C#. But to be honest my C++ skills are at an alltime low.

So forgive me for almost begging. This would so save my behind.

Re: C# DLL

erlando wrote:

I am badly in need of being able to use libnfc via C#.

I found the best way was to write a COM object that exposed an OLE automation interface with a type library allowing the interop framework to use it.

Re: C# DLL

Roel: Do you still have the example you sent me some time ago? I'm doing some progress with the RFID reader that i got from acs bot i have some problems with the reader that touchatag provides. If you still have the example i want to try again to get it working.

Re: C# DLL

Does anybody solved C# problems with libnfc? (except COM object communication)???
There has to be more user (developer) friendly way :-(

Re: C# DLL

I try to use as libnfc in Visual Studio 2008 to make an application in C # too.

I have a module equipped with an NFC PN533.

News about a possible use of libnfc C # under Windows 7?

I compiled everything but I do not have enough knowledge to integrate libnfc.

thank you