[Openal] OpenAL with C++ WindowsForm application?
stapostol at gmail.com
Mon Sep 28 08:05:07 PDT 2009
On Mon, 2009-09-28 at 10:48 -0400, Jason Daly wrote:
> I'm not an authority on CLR or Forms, but I do know that if you want to
> use OpenAL with the CLR, you'll have to wrap the library so you can
> access the native OpenAL methods from your managed code.
Generally, C++/CLI supports "it just works" (IJW) interop with plain C
libraries, but there might be few cases where you'll have to fix things
by hand. I'm not especially familiar with C++/CLI but this seems like
one of those cases.
The CLR generally uses delegates to pass managed function pointers to
unmanaged code and vice versa. Try wrapping this function to receive a
delegate decorated decorated with the UnmangedFunctionPointerAttribute.
The other approach is to use a full-blown managed wrapper around OpenAL
and avoid the need to wrap things by hand. There are a few of those out
there - I'd recommend OpenTK (http://www.opentk.com), if only because I
happen to be its main developer. :) This is a low-level, "flat" wrapper
around OpenAL (i.e. *not* an object oriented abstraction), but it takes
advantage of some features not available in plain C (e.g. strong types,
enumerations, function overloads,, generics).
> Ümit Uzun wrote:
> > Hi All,
> > I have an application which had created with MFC before and now I want
> > to upgrade it with new OpenAL 1.1 version and Windows Form. I have
> > created new C++ WindowsForm project in VS2008 and only add framework
> > and set related include and library configurations. But when I compile
> > I always get
> > .\OpenAL\framework\Win32\Framework.cpp(200) : error C2664:
> > 'CWaves::GetWaveALBufferFormat' : cannot convert parameter 2 from
> > 'ALenum (__cdecl *)(const ALchar *)' to 'PFNALGETENUMVALUE'
> > Address of a function yields __clrcall calling convention in /clr:pure
> > and /clr:safe; consider using __clrcall in target type
> > error which I can't find anything at internet about. I think it is
> > related about /clr because we have to use CommonLanguageRuntimeSupport
> > beside with MFC we don't need clr.
> > How can I solve my problem?
> > Do you think I can create OpenAL based application which uses
> > framework like before with Windows Form or not?
> > Regards.
> > Ümit Uzun
> Openal mailing list
> Openal at opensource.creative.com
More information about the Openal