Allow standalone win32 programs to exit the Contiki process by calling LOAD_UNLOAD().
This commit is contained in:
parent
ece7919f49
commit
284f7166b7
|
@ -30,7 +30,7 @@
|
||||||
#
|
#
|
||||||
# Author: Oliver Schmidt <ol.sc@web.de>
|
# Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
#
|
#
|
||||||
# $Id: Makefile.win32,v 1.19 2010/01/30 11:52:01 oliverschmidt Exp $
|
# $Id: Makefile.win32,v 1.20 2010/10/12 11:03:53 oliverschmidt Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
||||||
|
@ -53,6 +53,8 @@ ifdef PLATFORM_BUILD
|
||||||
CFLAGS += -DPLATFORM_BUILD -DWITH_LOADER_ARCH -DAUTOSTART_ENABLE
|
CFLAGS += -DPLATFORM_BUILD -DWITH_LOADER_ARCH -DAUTOSTART_ENABLE
|
||||||
LDFLAGS += -Wl,--out-implib=contiki-main.$(TARGET).a \
|
LDFLAGS += -Wl,--out-implib=contiki-main.$(TARGET).a \
|
||||||
-u _cfs_open -u _cfs_opendir -u _uiplib_ipaddrconv
|
-u _cfs_open -u _cfs_opendir -u _uiplib_ipaddrconv
|
||||||
|
else
|
||||||
|
CONTIKI_TARGET_SOURCEFILES += unload.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### Set a target-specific variable value
|
### Set a target-specific variable value
|
||||||
|
|
|
@ -127,6 +127,8 @@ typedef unsigned short uip_stats_t;
|
||||||
|
|
||||||
#ifdef PLATFORM_BUILD
|
#ifdef PLATFORM_BUILD
|
||||||
#define LOADER_CONF_ARCH "loader/dll-loader.h"
|
#define LOADER_CONF_ARCH "loader/dll-loader.h"
|
||||||
|
#else /* PLATFORM_BUILD */
|
||||||
|
#define LOADER_CONF_ARCH "loader/unload.h"
|
||||||
#endif /* PLATFORM_BUILD */
|
#endif /* PLATFORM_BUILD */
|
||||||
|
|
||||||
#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10
|
#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10
|
||||||
|
|
46
platform/win32/loader/unload.c
Normal file
46
platform/win32/loader/unload.c
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the Contiki operating system.
|
||||||
|
*
|
||||||
|
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
|
*
|
||||||
|
* $Id: unload.c,v 1.1 2010/10/12 11:03:53 oliverschmidt Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "ctk/ctk-draw.h"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
unload(void)
|
||||||
|
{
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
43
platform/win32/loader/unload.h
Normal file
43
platform/win32/loader/unload.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This file is part of the Contiki operating system.
|
||||||
|
*
|
||||||
|
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
|
*
|
||||||
|
* $Id: unload.h,v 1.1 2010/10/12 11:03:53 oliverschmidt Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __UNLOAD_H__
|
||||||
|
#define __UNLOAD_H__
|
||||||
|
|
||||||
|
#define LOADER_UNLOAD unload
|
||||||
|
|
||||||
|
void unload(void);
|
||||||
|
|
||||||
|
#endif /* __UNLOAD_H__ */
|
Loading…
Reference in a new issue