[vlc-devel] Re: including a .dll

Damien Fouilleul damien.fouilleul at laposte.net
Wed Sep 27 15:38:06 CEST 2006


here's what you need:

VLC_ADD_LDFLAGS([-L<path to dll> -linpout32])


typically, you don't link directly against a .DLL but against an import 
library, which could be named as per your case, either libinout32.a or 
inout32.lib, or something like that.
however, gcc is quite flexible and will link directly against a DLL.

the problem is that if VLC cannot locate the DLL when it starts, it will 
abort and throw an error.

You may want to weak link the library instead by adding the following 
code in your startup sequence

static short _stdcall (*Inp32)(short PortAddress);
static void _stdcall (*Out32)(short PortAddress, short data);

initInOut()
{
      HMODULE myDll = LoadLibrary("inpout32.dll");

      if ( NULL == myDLL ) /* do error condition */

      Inp32 = GetProcAddress(myDll, "Inp32");
      Out32= GetProcAddress(myDll, "Out32");
}
    
that way you can handle the case when the library is not found, and VLC 
will not abort unless you want it to.

Damien

Adam Collins wrote:
> Hi
>
> I need to include a .dll (inpout32.dll) file that controls parallel 
> port access under winXP, into my VLC build. I have tried to add the line
> VLC_ADD_LDFLAGS([inpout32])
> to the configure.ac <http://configure.ac> file
> and in my module I have declared the function prototypes
>
> short _stdcall Inp32(short PortAddress);
> void _stdcall Out32(short PortAddress, short data);
>
> and have add the call
>
> Out32(888,0);
>
> to my modules function. Unfortunately when I reconfigure it has no 
> errors but when I make I get the error
>
> undefined refrence to Out32(888,0)
>
> can anyone tell me what I'm doing wrong?
> or How to include parallel port access into VLC
>
> Thanx
> Adam


-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list