From: Marc V. <vai...@fa...> - 2009-05-19 15:56:06
|
On Mon, May 18, 2009 at 11:53:16PM +0200, Olivier Guilyardi wrote: > Jim Marshall wrote: > > Olivier Guilyardi wrote: > >> Hi, > >> > >> I'm trying to link against the Dirac LE time stretching msvc library[1]. > >> Whatever I do, I get undefined references to the dirac functions that I call, > >> when linking. > >> > >> I've tried converting to a mingw library using all sort of combinations of > >> reimp, pexports and dlltool. It doesn't change anything. > >> > >> Here is the full DiracLE.def file that reimp produces: > >> > >> LIBRARY "DiracLE.dll" > >> EXPORTS > >> ?DiracCreate@@YAPAXJJJMP6AJPAMJPAX@Z@Z > >> ?DiracCreate@@YAPAXJJJMP6AJPAPAMJPAX@Z@Z > >> ?DiracDestroy@@YAXPAX@Z > >> ?DiracGetInputBufferSizeInFrames@@YAJPAX@Z > >> ?DiracGetProperty@@YAOJPAX@Z > >> ?DiracProcess@@YAJPAMJPAX1@Z > >> ?DiracProcess@@YAJPAPAMJPAX1@Z > >> ?DiracReset@@YAX_NPAX@Z > >> ?DiracSetProperty@@YAJJOPAX@Z > >> ?DiracVersion@@YAPBDXZ > >> > >> Are these bogus question marks? > >> > >> Any clue? > >> > >> > > Looks like those are C++ functions, presumably the DLL was compiled with > > the Microsoft C++ compiler. Unfortunately you can not mix C++ code from > > different vendors since each vendor has there own 'name mangling' scheme. This is not exactly correct. Yes, C++ name mangling is different across vendors, however Any vendor that supports COM is vtable ABI compatible. Please consult http://aegisknight.org/cppinterface.html which outlines how to create binary compatible C++ interfaces. The basic idea is for your classes to have only virtual functions, and to have C factory methods for creating instances of them. > > Thanks for your answer. > > Do you think I could write a small C'ish wrapping library around DiracLE, > compile it with msvc and then link this in mingw? Could I export (reimp > friendly) C symbols from my wrapper, knowing that it will itself be linked with > the DiracLE C++ library? Yes, you can do this. If you want your wrapper to be C++ then you can also do that by following the article I reference above. Marc |