Noob alert - my experience with C# includes reading Petzold's free book (.NET Book Zero) and some fooling around with VC# Express Edition. (Wagner's "Effective C#" is in the queue.) I hope my question is on topic here. It seems to be a bit on the on the edge of that, so if it is not, no offense will be taken if you lock or delete this thread.
I wish to have an application examine EXIF tags in JPEG and similar files. I have found a C library - libexif - which should meet my needs. It is is open sourced and seems to be well documented. I have started a first cut of this by trying to convert the many C structs used by libexif into C# classes or structs.
The libexif library data structures consist of a number of deeply nested structs. Some of the structs include pointers to other structs as well as arrays of pointers to other structs. Overall, this seems not a very friendly API to expose to C#. I have a deeply held belief that it sould be possible to use P/Invoke to access it, but I could see spending days (hopefully not more!) getting every little bit sorted.
That may not be a bad thing, since my interest is to learn C#, though my desire is not to become an expert at P/Invoke.
I see three avenues to approach the problem:
1. Continue to slug it out, studying the MarshalAs options and other P/Invoke arcana until I have mastered the subject sufficiently to translate some relatively complex data structures to something usable from C#. This seems likely to be the most work, but I also learn the most.
2. Cave in and download the tool at this web site and see if it does my work for me. This could be the least work. I would only learn to the extent that I study the results that the tool produces. That also presumes the tool produces correct results and I would be in a very poor position to determine that.
3. Write a wrapper for the libexif library in C that exposes an API that is much more friendly to C#. This opens another can-O-worms in that I have to figure out how to produce a DLL using VC Express edition.
I would appreciate your thoughts on what strategy to choose. Or if you can suggest yet another approach, please do so! Please do constrain the solution to something that calls a C library from C# as that is a skill I will need for the next project I plan to work on.
I'm no stranger to programming and my most recent experience has been an embedded system written in C with previous experience including Perl, Java and C++ on Windows, Solaris, AIX, Linux and some other embedded systems.
Many thanks for your help.
edit: didn't notice typo in subject!