"not_a_commie" <no********@gmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.com...
Suppose I have some random C DLL. I want to generate a C# wrapper for
it automatically. (By wrapper I mean a large file with a bunch of
[dllimport...] static extern ...., etc.) What tools exist to do this
automatically?
As far as I know there is no such tool, more, if there existed one, I would
not trust it, translating C function calls into DllImport declarations is
something you can only do by hand, even then it's error prone, C function
declarations don't reveal everything you need to know to correctly declare
your DlImport.
Note also that the translation of a function declaration is not that
problematic, translating the data types like structs is the real issue. Note
also, that it's easier to write a managed wrapper using C++/CLI when you
need to import a bunch of native C function into the managed world.
Willy.