loadrtdll.c

来自「windows系统下实时代码,可以进行底层硬件的实时操作」· C语言 代码 · 共 57 行

C
57
字号
/*++
 *
 * Copyright (c) 1998-2005, Ardence, Inc.  All rights reserved.
 *
 * Module Name:
 *
 *      LoadRtdll.c
 *
 * Abstract:
 *
 *		A simple utility to load a RTDLL
 *
 *
 * Environment:
 *
 *      RTX application (RTSS). 
 *
 * Revision History:
 *      
 *      Appended exit from this program (LT)
 *
 *     
--*/
#include <windows.h>
#include <stdio.h>
#include <rtapi.h>

#define NO_ERRORS		0
#define ERROR_OCCURED	-1


int main(int argc, char* argv[])
{

	HANDLE hLibModule = NULL;
	LPCSTR lpLibFileName = "rtdllexample.dll";

	//load Library sampleRtdll
	hLibModule = LoadLibrary(lpLibFileName);

	//check if loadLibrary returned correctly 
	if(hLibModule==NULL)
	{
		//error caused by loading a corrupt or unregistered Rtdll
		RtPrintf("LoadRtdll: ERROR: LoadLibrary() failed.  Get last Error = %d\n", GetLastError());
		RtPrintf("%s maybe corrupt or not registered with RTSS\n", lpLibFileName);
		return (ERROR_OCCURED);
	}

	// Before exit, wait 3 sec. to let start "TestRtdll.rtss" process
	Sleep(3000);

    // Even program exits now - "rtdllexample.dll" will not be unloaded unless all
	// "TestRtdll.rtss" processes finish
	return (NO_ERRORS);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?