<div>It's not so much a matter of interface as a matter of the complex data structures used by the library. To call a C or C++ library, you have to map the data types used by the interface to something that .NET can manipulate,
i.e., .NET types. It is pretty easy to do for simple types or structures, but it becomes a nightmare when you deal with nested structs and unions.</div>
<div> </div>
<div>The approach you're proposing might work. I need to take a look at your latest interface (I last tried on 1.1.3). Maybe I'll try again some day, just subsetting the decoder and wrapping it into an API that does not expose the complex data structure. It will probably boost my performance...
<br> </div>
<div>Pyt.<br> </div>
<div><span class="gmail_quote">On 6/14/07, <b class="gmail_sendername"><a href="mailto:xflac@yahoo.com">xflac@yahoo.com</a></b> <<a href="mailto:xflac@yahoo.com">xflac@yahoo.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">is wrapping c++ any easier? because there is libFLAC++<br><br>otherwise, if you only need a certain subset of what FLAC does
<br>it might be easier to write a smaller C interface + wrapper<br>implementation, then import that in c#.<br><br>Josh<br><br>--- Pyt <<a href="mailto:py.thoulon@gmail.com">py.thoulon@gmail.com</a>> wrote:<br><br>> I tried that approach a while ago and failed miserably. Marshalling
<br>> the<br>> structs of structs in the flac lib turned out to be a nightmare (I<br>> don't<br>> pretend to be an expert, mind you...).<br>> I eventually switched to writing my own C# lib from scratch. Work is
<br>> still<br>> under progress. It's no rocket science, I do this a G-job. It has<br>> definite<br>> limitations (no documentation, decodes only 16-bit files, no encode,<br>> *much*<br>> slower than the flac reference implementation, but still reasonable
<br>> for what<br>> I do), but it can read and write metadata. It still needs a bit of<br>> polishing<br>> (esp. the documentation to be usable), but I'd be willing to share it<br>> at<br>> some point. Note that it's not open source for the time being, but
<br>> that<br>> could be considered.<br>><br>> Pyt.<br>><br>> PS: If anybody has a real pinvoke wrapper for the reference lib, I'd<br>> gladly<br>> take it... !<br>><br>><br>> On 6/14/07, Jud White -
<a href="mailto:jwhite@cdtag.com">jwhite@cdtag.com</a> <+flac-<br>> <a href="mailto:dev+pyt+af0255c9db.jwhite#cdtag.com@spamgourmet.com">dev+pyt+af0255c9db.jwhite#cdtag.com@spamgourmet.com</a>> wrote:<br>> >
<br>> > Harry,<br>> ><br>> > DllImport is the way to go, but it's not always straightforward<br>> what to<br>> > do (callbacks, pointers, and structs can get tricky).<br>> > <a href="http://pinvoke.net/">
http://pinvoke.net/</a> is a good resource for mapping Win32 API to C#<br>> using<br>> > DllImport, you may find it useful for your efforts. I also found<br>> this<br>> > article helpful in context of DllImport:
<br>> > <a href="http://www.vsj.co.uk/articles/display.asp?id=501">http://www.vsj.co.uk/articles/display.asp?id=501</a>.<br>> ><br>> > I have some C# code for working with FLAC and Vorbis Comments that<br>
> does<br>> > not use the FLAC libraries:<br>> ><br>> ><br>><br><a href="http://idsharp.svn.sourceforge.net/viewvc/idsharp/IdSharp.Tagging/trunk/Tagging/VorbisComment/Classes/">http://idsharp.svn.sourceforge.net/viewvc/idsharp/IdSharp.Tagging/trunk/Tagging/VorbisComment/Classes/
</a><br>> ><br>> ><br>><br><a href="http://idsharp.svn.sourceforge.net/viewvc/idsharp/IdSharp.AudioInfo/trunk/Flac/">http://idsharp.svn.sourceforge.net/viewvc/idsharp/IdSharp.AudioInfo/trunk/Flac/</a><br>> >
<br>> > taglib# also handles flac<br>> ><br>> > Erik de Castro Lopo wrote:<br>> > > Harry Sack wrote:<br>> > ><br>> > ><br>> > >> but aren't they C++ headers en lib's?
<br>> > >><br>> > ><br>> > > Not C++, C.<br>> > ><br>> > ><br>> > >> I have no idea how I can include a C++<br>> > >> header in a C# project.<br>> > >> It this even possible?
<br>> > >><br>> > ><br>> > > Yes. Google for "dllimport csharp".<br>> > ><br>> > > Erik<br>> > ><br>> > _______________________________________________
<br>> > Flac-dev mailing list<br>> > <a href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</a><br>> > <a href="http://lists.xiph.org/mailman/listinfo/flac-dev">http://lists.xiph.org/mailman/listinfo/flac-dev
</a><br>> ><br>> > _______________________________________________<br>> Flac-dev mailing list<br>> <a href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</a><br>> <a href="http://lists.xiph.org/mailman/listinfo/flac-dev">
http://lists.xiph.org/mailman/listinfo/flac-dev</a><br>><br><br><br><br><br>____________________________________________________________________________________<br>Get the free Yahoo! toolbar and rest assured with the added security of spyware protection.
<br><a href="http://new.toolbar.yahoo.com/toolbar/features/norton/index.php">http://new.toolbar.yahoo.com/toolbar/features/norton/index.php</a><br></blockquote></div><br>