
// ToolMain.cpp for MiniCad Externals SDK 8.0
//
// Copyright © Diehl Graphsoft, Inc. 1998.
// All Rights Reserved.
//
// This file serves as the main entry point for external tools. This should be included
// into Mac and Windows project files as the supported main entry point for the external.
// the user should then implement the entry point documented in MiniCadHookIntf.h
//
//
// Last SourceSafe check-in:
//		$Revision: 1 $
//		$Date: 6/08/00 12:28p $
//
// Started 8/97 by Paul C. Pharr



#if _WINDOWS && !ALTURA

	#if _AFXDLL
		#include "StdAfx.h"
		#error "Plug-ins should not be linked against DLL based MFC. See comment in GSESetup.h."
	#else
		#include <Windows.h>
	#endif

#include "GSWinSDK.h"	// Graphsoft Required.
#else
#include "StdHeaders.h"
#endif

#if _WIN_EXTERNAL_
#include "GSWinSDK.h"	// Graphsoft Required.
#endif

#include <GSESetup.h>
#include <MiniCadHookIntf.h>
#include <GSString.X.h>
#include <ExtendedProperties.h>
#include <VWInterfaces.h>


#if GS_WIN || GS_MAC_MACHO
extern "C" long GS_EXTERNAL_ENTRY plugin_main(long action, long message1, long message2, long& userData, CallBackPtr cbpParam)
#elif GS_MAC_CFM
extern "C" long GS_EXTERNAL_ENTRY main(long action, long message1, long message2, long& userData, CallBackPtr cbpParam)
#endif
{
	GSExternalSetup(cbpParam);

	long reply	= 0;
	
	{ // SCOPE
		// initialize VCOM mechanizm
		::GS_InitializeVCOM( gCBP );

		// Init gSDK
		VCOMPtr<VectorWorks::ISDK> localSDKPtr(VectorWorks::IID_SDK);
		gSDK = localSDKPtr;

		#if 0
		ASSERTPOINTER(kPaul, cbpParam, 1);
		ASSERTHEAP(kPaul);
		//ASSERTLEGALPORTM("In '...' external.");
		
		ASSERTN(kPaul, cbp != nil);
		#endif

			
		// call the user's main function
		reply = ToolMain(action, message1, message2, userData);
	}

	GSExternalSetdown(0L);
	return reply;
}




