// Copyright FiveTech 1993-08  - 2nd version with no data types passed in

// modified by Roger Seiler with FiveTech authorization; this does not require
// any part of FWH and can operate solely with xHarbour.

// DLLxHb.ch - enables using same syntax with xHb's DLLCALL as with FWH's DLL32

#ifndef _DLLxHb_CH
#define _DLLxHb_CH

#define DC_CALL_STD           0 // 0x0020

#translate NOREF([@]<x>) => <x>
//----------------------------------------------------------------------------//

#xcommand DLLxHb FUNCTION <FuncName>( [ <uParam1> ] [, <uParamN>  ] ) ;
             LIB <*DllName*> ;
       => ;
           function <FuncName>( [NOREF(<uParam1>)] [,NOREF(<uParamN>)] ) ;;
             local hDLL := If( ValType( <DllName> ) == "N", <DllName>, LoadLibrary( <(DllName)> ) ) ;;
             local uResult := 0 ;;
             if Abs( hDLL ) > 32 ;;
                uResult = DLLCall( hDLL, DC_CALL_STD, <(FuncName)> [,<uParam1>] [,<uParamN>] ) ;;
                If( ValType( <DllName> ) == "N",, FreeLibrary( hDLL ) ) ;;
             else ;;
             end ;;
          return uResult

// This previous "else" code gpf's, even with FWH...
//                If( ValType( <DllName> ) == "C", <DllName>, Str( <DllName> ) ) ) ;;
//                MsgAlert( "Error code: " + LTrim( Str( hDLL ) ) + " loading " + ;

//----------------------------------------------------------------------------//
