///////////////////////////////////////////////////////////////////////////
//
//  NAME
//    mcapi_dl.cpp - C/C+++ dynamic link file for MCAPI
//
//  DESCRIPTION
//    This file provides support for dynamically linking a C/C++
//    application to PMC's Motion Control API. 
//
//    To change your application from standard static linking (i.e. using
//    MCAPI32.LIB) to dynamic linking:
//
//      1. Include this file (MCAPI.CPP) in your project
//      2. Remove any reference to MCAPI32.LIB from your project
//      3. Replace the standard MCAPI header file (MCAPI.H) with the 
//         version that accompanied MCAPI.CPP
//      4. Add a call to MCLoadApi() prior to calling any API function
//
//  RELEASE HISTORY
//    Copyright (c) 2002-2012 by Precision Micro Control Corp. All rights
//    reserved.
//
//    $Id: mcapi_dl.cpp 796 2013-04-20 00:35:12Z brian $
//
//    Version 3.2.0      4-Jan-02       Programmer: Brian Gaynor
//      - First release
//
//    Version 3.2.1     26-Apr-02       Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 3.3.0		15-Jan-03		Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 3.4.0		 2-Jun-03		Programmer: Brian Gaynor
//      - Moved MCFindAuxEncIdx() address load to the version 2.2.0 or
//        higher area (was incorrectly in version 2.1.0 or higher)
//      - Added MCEnableEncoderFault() and constants MC_ENC_FAULT_PRI,
//        MC_ENC_FAULT_SEC for encoder fault detection feature of
//        Multiflex series of controllers
//      - Added MCGetAnalogEx/()MCSetAnalogEx() to make it easier for
//        Visual Basic users to handle 16-bit unsigned values
//      - Added pmcgetramex() and pmcputramex() to support larger memory
//        space of the PCI controllers (32-bit address offset and size)
//      - Added new fields to MCAXISCONFIG and MCPARAMEX structures
//
//    Version 3.4.1		31-Oct-03		Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 3.4.2		 5-Jul-04		Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 3.5.0		19-Nov-04		Programmer: Brian Gaynor
//      - Renamed to mcapi_dl.cpp so the dynamic linking code can more 
//        easily co-exist with the standard headers
//      - Added MCGetModuleOutputMode()
//      - Added MCGetVelocityOverride() / MCSetVelocityOverride()
//
//    Version 3.5.1		 1-Feb-05		Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 3.5.2		24-Feb-05		Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 4.0.0		16-Jan-06		Programmer: Brian Gaynor
//      - Converted long int types to int, doesn't effect 32-bit code,
//        sizeof(long int) == sizeof(int), but this will make sure that 
//        parameter sizes don't swell under 64-bit builds
//      - Added MCGetDigitalIOEx(), can return status of 32 digital I/O
//        channels in one call (BR #121).
//      - Wrapper functions for the platform specific dynamic function 
//        loading libraries are now used, enabling this code to work on 
//        Linux as well as Windows.
//
//    Version 4.0.1		27-Mar-06		Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 4.0.2		21-Apr-06		Programmer: Brian Gaynor
//      - No changes to this module
//
//    Version 4.0.3		17-Nov-06		Programmer: Brian Gaynor
//      - Removed include for stdafx.h (needed for precompiled headers). If
//        your app has precompiled headers enabled in Visual Studio simply
//        select this file from the Solution View and disable precompiled 
//        headers for this file.
//
//    Version 4.0.4		16-May-07		Programmer: Brian Gaynor
//      - No changes
//
//    Version 4.0.5		13-Jul-07		Programmer: Brian Gaynor
//      - No changes
//
//    Version 4.1.0		 1-Dec-08		Programmer: Brian Gaynor
//      - Changes to code that loads function pointers to quiet C4076 
//        warnings from Visual Studio (bug #100143).
//      - Added constant MC_COMPARE _STROBE for new "strobe" output mode 
//        of compare function.
//      - Added new MCGetJogConfigEx() / MCSetJogConfig() prototypes and
//        MCJOGEX data structure declaration.
//      - Added new MCGetTrajectoryRate() / MCSetTrajectoryRate()
//        prototypes for checking/setting the trajectory rate on the 
//        MFX-ETH.
//
//    Version 4.1.1		14-Jul-09		Programmer: Brian Gaynor
//      - Added an error constant for TCP/IP socket errors.
//
//    Version 4.1.2		25-Sep-09		Programmer: Brian Gaynor
//      - Fix pmcputs address load (needed const qualifier to match
//        function prototype).
//
//    Version 4.2.0		 1-Apr-10		Programmer: Brian Gaynor
//      - Added the LineModeAscii flag to the PARAMEX structture, allows
//        programs to optimize I/O with line oriented controllers such as
//        the Ethernet controller.
//
//    Version 4.3.0		19-Nov-12		Programmer: Brian Gaynor
//      - Added pmccmdrpyex(), pmclock(), pmcunlock(), pmclookupvar()
//
//    Version 4.3.1		XX-Apr-13		Programmer: Brian Gaynor
//      - DLL not found will now return MCERR_NOT_FOUND to differentiate
//        from missing functions which return MCERR_NOT_PRESENT. Missing
//        DLL usually means no API installed (application may want to run
//        in an offline mode), whereas missing functions usually mean the
//        version of the API installed is too old (bug #100201).
//
///////////////////////////////////////////////////////////////////////////

#include "stdafx.h"			// you may need to modify to match your project

//
//  API Function pointer declarations
//
void			(APIENTRY* MCAbort)(HCTRLR, WORD);
int				(APIENTRY* MCArcCenter)(HCTRLR, WORD, short int, double);
int				(APIENTRY* MCBlockBegin)(HCTRLR, int, int);
int				(APIENTRY* MCBlockEnd)(HCTRLR, int*);
int				(APIENTRY* MCCancelTask)(HCTRLR, int);
int				(APIENTRY* MCCaptureData)(HCTRLR, WORD, int, double, double);
short int		(APIENTRY* MCClose)(HCTRLR hCtlr);
short int		(APIENTRY* MCConfigureDigitalIO)(HCTRLR, WORD, WORD);
int				(APIENTRY* MCContourDistance)(HCTRLR, WORD, double);
int				(APIENTRY* MCContourPath)(HCTRLR, WORD, WORD, char*);
int				(APIENTRY* MCDecodeStatus)(HCTRLR, DWORD, int);
void			(APIENTRY* MCDirection)(HCTRLR, WORD, WORD);
void			(APIENTRY* MCEnableAxis)(HCTRLR, WORD, short int);
int				(APIENTRY* MCEnableBacklash)(HCTRLR, WORD, double, short int);
void			(APIENTRY* MCEnableDigitalIO)(HCTRLR, WORD, short int);
void			(APIENTRY* MCEnableGearing)(HCTRLR, WORD, WORD, double, short int);
void			(APIENTRY* MCEnableJog)(HCTRLR, WORD, short int);
void			(APIENTRY* MCEnableSync)(HCTRLR, WORD, short int);
void			(APIENTRY* MCErrorNotify)(HWND hWnd, HCTRLR, DWORD);
int				(APIENTRY* MCFindEdge)(HCTRLR, WORD, double);
int				(APIENTRY* MCFindIndex)(HCTRLR, WORD, double);
int				(APIENTRY* MCGetAccelerationEx)(HCTRLR, WORD, double*);
WORD			(APIENTRY* MCGetAnalog)(HCTRLR, WORD);
int				(APIENTRY* MCGetAuxEncIdxEx)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetAuxEncPosEx)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetBreakpointEx)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetCaptureData)(HCTRLR, WORD, int, int, int, double*);
void			(APIENTRY* MCGetConfiguration)(HCTRLR, MCPARAM*);
short int		(APIENTRY* MCGetContourConfig)(HCTRLR, WORD, MCCONTOUR*);
int				(APIENTRY* MCGetContouringCount)(HCTRLR, WORD);
int				(APIENTRY* MCGetDecelerationEx)(HCTRLR, WORD, double*);
short int		(APIENTRY* MCGetError)(HCTRLR);
short int		(APIENTRY* MCGetDigitalIO)(HCTRLR, WORD);
short int		(APIENTRY* MCGetFilterConfig)(HCTRLR, WORD, MCFILTER*);
int				(APIENTRY* MCGetFollowingError)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetGain)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetIndexEx)(HCTRLR, WORD, double*);
short int		(APIENTRY* MCGetJogConfig)(HCTRLR, WORD, MCJOG*);
int				(APIENTRY* MCGetLimits)(HCTRLR, WORD, short int*, short int*, double*, double*);
short int		(APIENTRY* MCGetMotionConfig)(HCTRLR, WORD, MCMOTION*);
int				(APIENTRY* MCGetOptimalEx)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetPositionEx)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetProfile)(HCTRLR, WORD, WORD*);
int				(APIENTRY* MCGetRegister)(HCTRLR, int, void*, int);
short int		(APIENTRY* MCGetScale)(HCTRLR, WORD, MCSCALE*);
int				(APIENTRY* MCGetServoOutputPhase)(HCTRLR, WORD, WORD*);
DWORD			(APIENTRY* MCGetStatus)(HCTRLR, WORD);
int				(APIENTRY* MCGetTargetEx)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetTorque)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetTrajectoryRate)(HCTRLR, int*);
int				(APIENTRY* MCGetVectorVelocity)(HCTRLR, WORD, double*);
int				(APIENTRY* MCGetVelocityEx)(HCTRLR, WORD, double*);
DWORD			(APIENTRY* MCGetVersion)(HCTRLR);
void			(APIENTRY* MCGo)(HCTRLR, WORD);
void			(APIENTRY* MCGoHome)(HCTRLR, WORD);
int				(APIENTRY* MCLearnPoint)(HCTRLR, WORD, int, WORD);
void			(APIENTRY* MCMacroCall)(HCTRLR, WORD);
void			(APIENTRY* MCMoveAbsolute)(HCTRLR, WORD, double);
void			(APIENTRY* MCMoveRelative)(HCTRLR, WORD, double);
int				(APIENTRY* MCMoveToPoint)(HCTRLR, WORD, int);
HCTRLR			(APIENTRY* MCOpen)(short int, WORD, LPCSTR);
int				(APIENTRY* MCReopen)(HCTRLR, WORD);
int				(APIENTRY* MCRepeat)(HCTRLR, int);
void			(APIENTRY* MCReset)(HCTRLR, WORD);
void			(APIENTRY* MCSetAcceleration)(HCTRLR, WORD, double);
void			(APIENTRY* MCSetAnalog)(HCTRLR, WORD, WORD);
void			(APIENTRY* MCSetAuxEncPos)(HCTRLR, WORD, double);
short int		(APIENTRY* MCSetContourConfig)(HCTRLR, WORD, MCCONTOUR*);
void			(APIENTRY* MCSetDeceleration)(HCTRLR, WORD, double);
short int		(APIENTRY* MCSetFilterConfig)(HCTRLR, WORD, MCFILTER*);
int				(APIENTRY* MCSetGain)(HCTRLR, WORD, double);
short int		(APIENTRY* MCSetJogConfig)(HCTRLR, WORD, MCJOG*);
int				(APIENTRY* MCSetLimits)(HCTRLR, WORD, short int, short int, double, double);
void			(APIENTRY* MCSetModuleOutputMode)(HCTRLR, WORD, WORD);
short int		(APIENTRY* MCSetMotionConfig)(HCTRLR, WORD, MCMOTION*);
void			(APIENTRY* MCSetOperatingMode)(HCTRLR, WORD, WORD, WORD);
void			(APIENTRY* MCSetPosition)(HCTRLR, WORD, double);
void			(APIENTRY* MCSetProfile)(HCTRLR, WORD, WORD wMode);
int				(APIENTRY* MCSetRegister)(HCTRLR, int, void*, int);
short int		(APIENTRY* MCSetScale)(HCTRLR, WORD, MCSCALE*);
void			(APIENTRY* MCSetServoOutputPhase)(HCTRLR, WORD, WORD);
int				(APIENTRY* MCSetTimeoutEx)(HCTRLR, double, double*);
int				(APIENTRY* MCSetTorque)(HCTRLR, WORD, double);
int				(APIENTRY* MCSetTrajectoryRate)(HCTRLR, int);
int				(APIENTRY* MCSetVectorVelocity)(HCTRLR, WORD, double);
void			(APIENTRY* MCSetVelocity)(HCTRLR, WORD, double);
void			(APIENTRY* MCStop)(HCTRLR, WORD);
void			(APIENTRY* MCWait)(HCTRLR, double);
void			(APIENTRY* MCWaitForDigitalIO)(HCTRLR, WORD, short int);
int				(APIENTRY* MCWaitForEdge)(HCTRLR, WORD, short int);
void			(APIENTRY* MCWaitForPosition)(HCTRLR, WORD, double);
void			(APIENTRY* MCWaitForRelative)(HCTRLR, WORD, double);
void			(APIENTRY* MCWaitForStop)(HCTRLR, WORD, double);
void			(APIENTRY* MCWaitForTarget)(HCTRLR, WORD, double);
short int		(APIENTRY* pmccmd)(HCTRLR, short int, void*);
short int		(APIENTRY* pmcgetc)(HCTRLR);
void			(APIENTRY* pmcgetram)(HCTRLR, WORD, void*, short int);
short int		(APIENTRY* pmcgets)(HCTRLR, char*, short int);
short int		(APIENTRY* pmcputc)(HCTRLR, short int);
void			(APIENTRY* pmcputram)(HCTRLR, WORD, void*, short int);
short int		(APIENTRY* pmcputs)(HCTRLR, const char*);
short int		(APIENTRY* pmcrdy)(HCTRLR);
short int		(APIENTRY* pmcrpy)(HCTRLR, short int, char*);

#if (_MCAPI_VER >= 210)

int				(APIENTRY* MCGetDigitalIOConfig)(HCTRLR, WORD, WORD*);
int				(APIENTRY* MCGoEx)(HCTRLR, WORD, double);
int				(APIENTRY* MCTranslateErrorEx)(short int, LPSTR, int);

#endif

#if (_MCAPI_VER >= 220)

int				(APIENTRY* MCArcEndAngle)(HCTRLR, WORD, short int, double);
int				(APIENTRY* MCArcRadius)(HCTRLR, WORD, double);
int				(APIENTRY* MCFindAuxEncIdx)(HCTRLR, WORD, double);
int				(APIENTRY* MCIndexArm)(HCTRLR, WORD, double);
int				(APIENTRY* MCIsAtTarget)(HCTRLR, WORD, double);
int				(APIENTRY* MCIsStopped)(HCTRLR, WORD, double);
int				(APIENTRY* pmccmdex)(HCTRLR, WORD, WORD, void*, int);
int				(APIENTRY* pmcrpyex)(HCTRLR, void*, int);

#endif

#if (_MCAPI_VER >= 300)

int				(APIENTRY* MCGetAxisConfiguration)(HCTRLR, WORD, MCAXISCONFIG*);
int				(APIENTRY* MCGetConfigurationEx)(HCTRLR, MCPARAMEX*);
int				(APIENTRY* MCGetInstalledModules)(HCTRLR, int[], int);

#endif

#if (_MCAPI_VER >= 310)

int				(APIENTRY* MCConfigureCompare)(HCTRLR, WORD, double*, int, double, int, double);
int				(APIENTRY* MCEnableCapture)(HCTRLR, WORD, int);
int				(APIENTRY* MCEnableCompare)(HCTRLR, WORD, int);
int				(APIENTRY* MCEnableDigitalFilter)(HCTRLR, WORD, int);
int				(APIENTRY* MCGetCount)(HCTRLR, WORD, int, int*);
int				(APIENTRY* MCGetDigitalFilter)(HCTRLR, WORD, double*, int, int*);
int				(APIENTRY* MCIsDigitalFilter)(HCTRLR, WORD);
int				(APIENTRY* MCSetDigitalFilter)(HCTRLR, WORD, double*, int);

#endif

#if (_MCAPI_VER >= 320)

int				(APIENTRY* MCEdgeArm)(HCTRLR, WORD, double);
int				(APIENTRY* MCGetFilterConfigEx)(HCTRLR, WORD, MCFILTEREX*);
int				(APIENTRY* MCGetModuleInputMode)(HCTRLR, WORD, int*);
int				(APIENTRY* MCGetMotionConfigEx)(HCTRLR, WORD, MCMOTIONEX*);
int				(APIENTRY* MCGetOperatingMode)(HCTRLR, WORD, int*);
int				(APIENTRY* MCIsEdgeFound)(HCTRLR, WORD, double);
int				(APIENTRY* MCIsIndexFound)(HCTRLR, WORD, double);
int				(APIENTRY* MCSetCommutation)(HCTRLR, WORD, MCCOMMUTATION*);
int				(APIENTRY* MCSetFilterConfigEx)(HCTRLR, WORD, MCFILTEREX*);
int				(APIENTRY* MCSetModuleInputMode)(HCTRLR, WORD, int);
int				(APIENTRY* MCSetMotionConfigEx)(HCTRLR, WORD, MCMOTIONEX*);
int				(APIENTRY* MCWaitForIndex)(HCTRLR, WORD);

#endif

#if (_MCAPI_VER >= 330)

int				(APIENTRY* MCDecodeStatusEx)(HCTRLR, MCSTATUSEX*, int);
int				(APIENTRY* MCEnableInterrupt)(HWND, HCTRLR, WORD, DWORD, MCINTERRUPTPROC);
int				(APIENTRY* MCGetStatusEx)(HCTRLR, WORD, MCSTATUSEX*);
int				(APIENTRY* MCInterruptOnPosition)(HCTRLR, WORD, int, double);

#endif

#if (_MCAPI_VER >= 340)

int				(APIENTRY* MCEnableEncoderFault)(HCTRLR, WORD, int);
int				(APIENTRY* MCGetAnalogEx)(HCTRLR, int, DWORD*);
int				(APIENTRY* MCGetVelocityActual)(HCTRLR, WORD, double*);
int				(APIENTRY* MCSetAnalogEx)(HCTRLR, int, DWORD);
int				(APIENTRY* pmcgetramex)(HCTRLR, DWORD, void*, DWORD);
int				(APIENTRY* pmcputramex)(HCTRLR, DWORD, void*, DWORD);

#endif

#if (_MCAPI_VER >= 350)

int				(APIENTRY* MCGetModuleOutputMode)(HCTRLR, WORD, WORD*);
int				(APIENTRY* MCGetVelocityOverride)(HCTRLR, WORD, double*);
int				(APIENTRY* MCSetVelocityOverride)(HCTRLR, WORD, double);

#endif

#if (_MCAPI_VER >= 400)

int				(APIENTRY* MCGetDigitalIOEx)(HCTRLR, WORD, unsigned int*);

#endif

#if (_MCAPI_VER >= 410)

int				(APIENTRY* MCGetJogConfigEx)(HCTRLR, WORD, MCJOGEX*);
int				(APIENTRY* MCSetJogConfigEx)(HCTRLR, WORD, MCJOGEX*);
int				(APIENTRY* MCGetTrajectoryRate)(HCTRLR, int*);
int				(APIENTRY* MCSetTrajectoryRate)(HCTRLR, int);

#endif

#if (_MCAPI_VER >= 410)

int				(APIENTRY* MCGetJogConfigEx)(HCTRLR, WORD, MCJOGEX*);
int				(APIENTRY* MCSetJogConfigEx)(HCTRLR, WORD, MCJOGEX*);
int				(APIENTRY* MCGetTrajectoryRate)(HCTRLR, int*);
int				(APIENTRY* MCSetTrajectoryRate)(HCTRLR, int);

#endif

#if (_MCAPI_VER >= 430)

int				(APIENTRY* pmccmdrpyex(HCTRLR, WORD, WORD, void*, int, void*, int);
DWORD			(APIENTRY* pmclock)(HCTRLR, DWORD);
int				(APIENTRY* pmclookupvar)(HCTRLR, const char*, DWORD*);
void			(APIENTRY* pmcunlock)(HCTRLR);

#endif

///////////////////////////////////////////////////////////////////////////
//
//  NAME
//    MCLoadApi - loads Motion Control API function pointers
//
//  DESCRIPTION
//    Dynamically Loads functions from the Motion Control API DLL.
//
//  RETURNS
//    MCERR_NOERROR     - function pointers loaded okay
//    MCERR_NOT_PRESENT - function name not found
//
///////////////////////////////////////////////////////////////////////////

int MCLoadApi(void)
{
#ifdef _WIN32
	HINSTANCE hLib;
#else
	void* hLib;
#endif

	if (hLib = wl_dynloadopen(MCAPI_LIB)) 
	{
		if ((MCAbort = (void (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCAbort")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCArcCenter = (int (APIENTRY*)(HCTRLR, WORD, short int, double))wl_dynloadsym(hLib, "MCArcCenter")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCBlockBegin = (int (APIENTRY*)(HCTRLR, int, int))wl_dynloadsym(hLib, "MCBlockBegin")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCBlockEnd = (int (APIENTRY*)(HCTRLR, int*))wl_dynloadsym(hLib, "MCBlockEnd")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCCancelTask = (int (APIENTRY*)(HCTRLR, int))wl_dynloadsym(hLib, "MCCancelTask")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCCaptureData = (int (APIENTRY*)(HCTRLR, WORD, int, double, double))wl_dynloadsym(hLib, "MCCaptureData")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCClose = (short (APIENTRY*)(HCTRLR))wl_dynloadsym(hLib, "MCClose")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCConfigureDigitalIO = (short (APIENTRY*)(HCTRLR, WORD, WORD))wl_dynloadsym(hLib, "MCConfigureDigitalIO")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCContourDistance = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCContourDistance")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCContourPath = (int (APIENTRY*)(HCTRLR, WORD, WORD, char*))wl_dynloadsym(hLib, "MCContourPath")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCDecodeStatus = (int (APIENTRY*)(HCTRLR, DWORD, int))wl_dynloadsym(hLib, "MCDecodeStatus")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCDirection = (void (APIENTRY*)(HCTRLR, WORD, WORD))wl_dynloadsym(hLib, "MCDirection")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableAxis = (void (APIENTRY*)(HCTRLR, WORD, short int))wl_dynloadsym(hLib, "MCEnableAxis")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableBacklash = (int (APIENTRY*)(HCTRLR, WORD, double, short int))wl_dynloadsym(hLib, "MCEnableBacklash")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableDigitalIO = (void (APIENTRY*)(HCTRLR, WORD, short int))wl_dynloadsym(hLib, "MCEnableDigitalIO")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableGearing = (void (APIENTRY*)(HCTRLR, WORD, WORD, double, short int))wl_dynloadsym(hLib, "MCEnableGearing")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableJog = (void (APIENTRY*)(HCTRLR, WORD, short int))wl_dynloadsym(hLib, "MCEnableJog")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableSync = (void (APIENTRY*)(HCTRLR, WORD, short int))wl_dynloadsym(hLib, "MCEnableSync")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCErrorNotify = (void (APIENTRY*)(HWND, HCTRLR, DWORD))wl_dynloadsym(hLib, "MCErrorNotify")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCFindEdge = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCFindEdge")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCFindIndex = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCFindIndex")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetAccelerationEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetAccelerationEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetAnalog = (WORD (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCGetAnalog")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetAuxEncIdxEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetAuxEncIdxEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetAuxEncPosEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetAuxEncPosEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetBreakpointEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetBreakpointEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetCaptureData = (int (APIENTRY*)(HCTRLR, WORD, int, int, int, double*))wl_dynloadsym(hLib, "MCGetCaptureData")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetConfiguration = (void (APIENTRY*)(HCTRLR, MCPARAM*))wl_dynloadsym(hLib, "MCGetConfiguration")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetContourConfig = (short (APIENTRY*)(HCTRLR, WORD, MCCONTOUR*))wl_dynloadsym(hLib, "MCGetContourConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetContouringCount = (int (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCGetContouringCount")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetDecelerationEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetDecelerationEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetError = (short (APIENTRY*)(HCTRLR))wl_dynloadsym(hLib, "MCGetError")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetDigitalIO = (short (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCGetDigitalIO")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetFilterConfig = (short (APIENTRY*)(HCTRLR, WORD, MCFILTER*))wl_dynloadsym(hLib, "MCGetFilterConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetFollowingError = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetFollowingError")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetGain = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetGain")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetIndexEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetIndexEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetJogConfig = (short (APIENTRY*)(HCTRLR, WORD, MCJOG*))wl_dynloadsym(hLib, "MCGetJogConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetLimits = (int (APIENTRY*)(HCTRLR, WORD, short int*, short int*, double*, double*))wl_dynloadsym(hLib, "MCGetLimits")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetMotionConfig = (short (APIENTRY*)(HCTRLR, WORD, MCMOTION*))wl_dynloadsym(hLib, "MCGetMotionConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetOptimalEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetOptimalEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetPositionEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetPositionEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetProfile = (int (APIENTRY*)(HCTRLR, WORD, WORD*))wl_dynloadsym(hLib, "MCGetProfile")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetRegister = (int (APIENTRY*)(HCTRLR, int, void*, int))wl_dynloadsym(hLib, "MCGetRegister")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetScale = (short (APIENTRY*)(HCTRLR, WORD, MCSCALE*))wl_dynloadsym(hLib, "MCGetScale")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetServoOutputPhase = (int (APIENTRY*)(HCTRLR, WORD, WORD*))wl_dynloadsym(hLib, "MCGetServoOutputPhase")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetStatus = (DWORD (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCGetStatus")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetTargetEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetTargetEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetTorque = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetTorque")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetVectorVelocity = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetVectorVelocity")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetVelocityEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetVelocityEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetVersion = (DWORD (APIENTRY*)(HCTRLR))wl_dynloadsym(hLib, "MCGetVersion")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGo = (void (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCGo")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGoHome = (void (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCGoHome")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCLearnPoint = (int (APIENTRY*)(HCTRLR, WORD, int, WORD))wl_dynloadsym(hLib, "MCLearnPoint")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCMacroCall = (void (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCMacroCall")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCMoveAbsolute = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCMoveAbsolute")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCMoveRelative = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCMoveRelative")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCMoveToPoint = (int (APIENTRY*)(HCTRLR, WORD, int))wl_dynloadsym(hLib, "MCMoveToPoint")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCOpen = (HCTRLR (APIENTRY*)(short int, WORD, LPCSTR))wl_dynloadsym(hLib, "MCOpen")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCReopen = (int (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCReopen")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCRepeat = (int (APIENTRY*)(HCTRLR, int))wl_dynloadsym(hLib, "MCRepeat")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCReset = (void (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCReset")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetAcceleration = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetAcceleration")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetAnalog = (void (APIENTRY*)(HCTRLR, WORD wChannel, WORD))wl_dynloadsym(hLib, "MCSetAnalog")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetAuxEncPos = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetAuxEncPos")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetContourConfig = (short (APIENTRY*)(HCTRLR, WORD, MCCONTOUR*))wl_dynloadsym(hLib, "MCSetContourConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetDeceleration = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetDeceleration")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetFilterConfig = (short (APIENTRY*)(HCTRLR, WORD, MCFILTER*))wl_dynloadsym(hLib, "MCSetFilterConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetGain = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetGain")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetJogConfig = (short (APIENTRY*)(HCTRLR, WORD, MCJOG*))wl_dynloadsym(hLib, "MCSetJogConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetLimits = (int (APIENTRY*)(HCTRLR, WORD, short int, short int, double, double))wl_dynloadsym(hLib, "MCSetLimits")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetModuleOutputMode = (void (APIENTRY*)(HCTRLR, WORD, WORD))wl_dynloadsym(hLib, "MCSetModuleOutputMode")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetMotionConfig = (short (APIENTRY*)(HCTRLR, WORD, MCMOTION*))wl_dynloadsym(hLib, "MCSetMotionConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetOperatingMode = (void (APIENTRY*)(HCTRLR, WORD, WORD, WORD))wl_dynloadsym(hLib, "MCSetOperatingMode")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetPosition = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetPosition")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetProfile = (void (APIENTRY*)(HCTRLR, WORD, WORD))wl_dynloadsym(hLib, "MCSetProfile")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetRegister = (int (APIENTRY*)(HCTRLR, int, void*, int))wl_dynloadsym(hLib, "MCSetRegister")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetScale = (short (APIENTRY*)(HCTRLR, WORD, MCSCALE*))wl_dynloadsym(hLib, "MCSetScale")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetServoOutputPhase = (void (APIENTRY*)(HCTRLR, WORD, WORD))wl_dynloadsym(hLib, "MCSetServoOutputPhase")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetTimeoutEx = (int (APIENTRY*)(HCTRLR, double, double*))wl_dynloadsym(hLib, "MCSetTimeoutEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetTorque = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetTorque")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetVectorVelocity = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetVectorVelocity")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetVelocity = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetVelocity")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCStop = (void (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCStop")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCTranslateErrorEx = (int (APIENTRY*)(short int, LPSTR, int))wl_dynloadsym(hLib, "MCTranslateErrorEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWait = (void (APIENTRY*)(HCTRLR, double))wl_dynloadsym(hLib, "MCWait")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWaitForDigitalIO = (void (APIENTRY*)(HCTRLR, WORD, short int))wl_dynloadsym(hLib, "MCWaitForDigitalIO")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWaitForEdge = (int (APIENTRY*)(HCTRLR, WORD, short int))wl_dynloadsym(hLib, "MCWaitForEdge")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWaitForPosition = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCWaitForPosition")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWaitForRelative = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCWaitForRelative")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWaitForStop = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCWaitForStop")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWaitForTarget = (void (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCWaitForTarget")) == 0)
			return MCERR_NOT_PRESENT;
	
	//
	//  Low level controller access commands
	//
		if ((pmccmd = (short (APIENTRY*)(HCTRLR, short int, void*))wl_dynloadsym(hLib, "pmccmd")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcgetc = (short (APIENTRY*)(HCTRLR))wl_dynloadsym(hLib, "pmcgetc")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcgetram = (void (APIENTRY*)(HCTRLR, WORD, void*, short int))wl_dynloadsym(hLib, "pmcgetram")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcgets = (short (APIENTRY*)(HCTRLR, char*, short int))wl_dynloadsym(hLib, "pmcgets")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcputc = (short (APIENTRY*)(HCTRLR, short int))wl_dynloadsym(hLib, "pmcputc")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcputram = (void (APIENTRY*)(HCTRLR, WORD, void*, short int))wl_dynloadsym(hLib, "pmcputram")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcputs = (short (APIENTRY*)(HCTRLR, const char*))wl_dynloadsym(hLib, "pmcputs")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcrdy = (short (APIENTRY*)(HCTRLR))wl_dynloadsym(hLib, "pmcrdy")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcrpy = (short (APIENTRY*)(HCTRLR, short int, char*))wl_dynloadsym(hLib, "pmcrpy")) == 0)
			return MCERR_NOT_PRESENT;

#if (_MCAPI_VER >= 210)
		if ((MCGetDigitalIOConfig = (int (APIENTRY*)(HCTRLR, WORD, WORD*))wl_dynloadsym(hLib, "MCGetDigitalIOConfig")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGoEx = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCGoEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCTranslateErrorEx = (int (APIENTRY*)(short int, LPSTR, int))wl_dynloadsym(hLib, "MCTranslateErrorEx")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 220)
		if ((MCArcEndAngle = (int (APIENTRY*)(HCTRLR, WORD, short int, double))wl_dynloadsym(hLib, "MCArcEndAngle")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCArcRadius = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCArcRadius")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCFindAuxEncIdx = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCFindAuxEncIdx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetAuxEncIdxEx = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetAuxEncIdxEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCIndexArm = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCIndexArm")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCIsAtTarget = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCIsAtTarget")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCIsStopped = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCIsStopped")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmccmdex = (int (APIENTRY*)(HCTRLR, WORD, WORD, void*, int))wl_dynloadsym(hLib, "pmccmdex")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcrpyex = (int (APIENTRY*)(HCTRLR, void*, int))wl_dynloadsym(hLib, "pmcrpyex")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 300)
		if ((MCGetAxisConfiguration = (int (APIENTRY*)(HCTRLR, WORD, MCAXISCONFIG*))wl_dynloadsym(hLib, "MCGetAxisConfiguration")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetConfigurationEx = (int (APIENTRY*)(HCTRLR, MCPARAMEX*))wl_dynloadsym(hLib, "MCGetConfigurationEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetInstalledModules = (int (APIENTRY*)(HCTRLR, int[], int))wl_dynloadsym(hLib, "MCGetInstalledModules")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 310)
		if ((MCConfigureCompare = (int (APIENTRY*)(HCTRLR, WORD, double*, int, double, int, double))wl_dynloadsym(hLib, "MCConfigureCompare")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableCapture = (int (APIENTRY*)(HCTRLR, WORD, int))wl_dynloadsym(hLib, "MCEnableCapture")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableCompare = (int (APIENTRY*)(HCTRLR, WORD, int))wl_dynloadsym(hLib, "MCEnableCompare")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableDigitalFilter = (int (APIENTRY*)(HCTRLR, WORD, int))wl_dynloadsym(hLib, "MCEnableDigitalFilter")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetCount = (int (APIENTRY*)(HCTRLR, WORD, int, int*))wl_dynloadsym(hLib, "MCGetCount")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetDigitalFilter = (int (APIENTRY*)(HCTRLR, WORD, double*, int, int*))wl_dynloadsym(hLib, "MCGetDigitalFilter")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCIsDigitalFilter = (int (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCIsDigitalFilter")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetDigitalFilter = (int (APIENTRY*)(HCTRLR, WORD, double*, int))wl_dynloadsym(hLib, "MCSetDigitalFilter")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 320)
		if ((MCEdgeArm = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCEdgeArm")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetFilterConfigEx = (int (APIENTRY*)(HCTRLR, WORD, MCFILTEREX*))wl_dynloadsym(hLib, "MCGetFilterConfigEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetModuleInputMode = (int (APIENTRY*)(HCTRLR, WORD, int*))wl_dynloadsym(hLib, "MCGetModuleInputMode")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetMotionConfigEx = (int (APIENTRY*)(HCTRLR, WORD, MCMOTIONEX*))wl_dynloadsym(hLib, "MCGetMotionConfigEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetOperatingMode = (int (APIENTRY*)(HCTRLR, WORD, int*))wl_dynloadsym(hLib, "MCGetOperatingMode")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCIsEdgeFound = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCIsEdgeFound")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCIsIndexFound = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCIsIndexFound")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetCommutation = (int (APIENTRY*)(HCTRLR, WORD, MCCOMMUTATION*))wl_dynloadsym(hLib, "MCSetCommutation")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetFilterConfigEx = (int (APIENTRY*)(HCTRLR, WORD, MCFILTEREX*))wl_dynloadsym(hLib, "MCSetFilterConfigEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetModuleInputMode = (int (APIENTRY*)(HCTRLR, WORD, int))wl_dynloadsym(hLib, "MCSetModuleInputMode")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetMotionConfigEx = (int (APIENTRY*)(HCTRLR, WORD, MCMOTIONEX*))wl_dynloadsym(hLib, "MCSetMotionConfigEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCWaitForIndex = (int (APIENTRY*)(HCTRLR, WORD))wl_dynloadsym(hLib, "MCWaitForIndex")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 330)
		if ((MCDecodeStatusEx = (int (APIENTRY*)(HCTRLR, MCSTATUSEX*, int))wl_dynloadsym(hLib, "MCDecodeStatusEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCEnableInterrupt = (int (APIENTRY*)(HWND, HCTRLR, WORD, DWORD, MCINTERRUPTPROC))wl_dynloadsym(hLib, "MCEnableInterrupt")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetStatusEx = (int (APIENTRY*)(HCTRLR, WORD, MCSTATUSEX*))wl_dynloadsym(hLib, "MCGetStatusEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCInterruptOnPosition = (int (APIENTRY*)(HCTRLR, WORD, int, double))wl_dynloadsym(hLib, "MCInterruptOnPosition")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 340)
		if ((MCEnableEncoderFault = (int (APIENTRY*)(HCTRLR, WORD, int))wl_dynloadsym(hLib, "MCEnableEncoderFault")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetAnalogEx = (int (APIENTRY*)(HCTRLR, int, DWORD*))wl_dynloadsym(hLib, "MCGetAnalogEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetVelocityActual = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetVelocityActual")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetAnalogEx = (int (APIENTRY*)(HCTRLR, int, DWORD))wl_dynloadsym(hLib, "MCSetAnalogEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcgetramex = (int (APIENTRY*)(HCTRLR, DWORD, void*, DWORD))wl_dynloadsym(hLib, "pmcgetramex")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcputramex = (int (APIENTRY*)(HCTRLR, DWORD, void*, DWORD))wl_dynloadsym(hLib, "pmcputramex")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 350)
		if ((MCGetModuleOutputMode = (int (APIENTRY*)(HCTRLR, WORD, WORD*))wl_dynloadsym(hLib, "MCGetModuleOutputMode")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetVelocityOverride = (int (APIENTRY*)(HCTRLR, WORD, double*))wl_dynloadsym(hLib, "MCGetVelocityOverride")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetVelocityOverride = (int (APIENTRY*)(HCTRLR, WORD, double))wl_dynloadsym(hLib, "MCSetVelocityOverride")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 400)
		if ((MCGetDigitalIOEx = (int (APIENTRY*)(HCTRLR, WORD, unsigned int*))wl_dynloadsym(hLib, "MCGetDigitalIOEx")) == 0)
			return MCERR_NOT_PRESENT;
#endif

#if (_MCAPI_VER >= 410)
		if ((MCGetJogConfigEx = (int (APIENTRY*)(HCTRLR, WORD, MCJOGEX*))wl_dynloadsym(hLib, "MCGetJogConfigEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetJogConfigEx = (int (APIENTRY*)(HCTRLR, WORD, MCJOGEX*))wl_dynloadsym(hLib, "MCSetJogConfigEx")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCGetTrajectoryRate = (int (APIENTRY*)(HCTRLR, int*))wl_dynloadsym(hLib, "MCGetTrajectoryRate")) == 0)
			return MCERR_NOT_PRESENT;
		if ((MCSetTrajectoryRate = (int (APIENTRY*)(HCTRLR, int))wl_dynloadsym(hLib, "MCSetTrajectoryRate")) == 0)
			return MCERR_NOT_PRESENT;

#endif

#if (_MCAPI_VER >= 430)

		if ((pmccmdrpyex = (int (APIENTRY*)(HCTRLR, WORD, WORD, void*, int, void*, int))wl_dynloadsym(hLib, "pmccmdrpyex")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmclock = (int (APIENTRY*)(HCTRLR, DWORD))wl_dynloadsym(hLib, "pmclock")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmclookupvar = (int (APIENTRY*)(HCTRLR, const char*, DWORD*))wl_dynloadsym(hLib, "pmclookupvar")) == 0)
			return MCERR_NOT_PRESENT;
		if ((pmcunlock = (int (APIENTRY*)(HCTRLR))wl_dynloadsym(hLib, "pmcunlock")) == 0)
			return MCERR_NOT_PRESENT;

#endif

	}
	else
		return MCERR_NOT_FOUND;
	
	return MCERR_NOERROR;
}