2015-05-29 19:36:29 +03:00
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
2017-02-17 06:20:15 +03:00
// RUN: %mkdir "%T/subdir" || true
// RUN: %rm "%T/subdir/libtest%shlibext"
// RUN: clang -DCLING_EXPORT=%dllexport -shared %S/call_lib.c -o %T/subdir/libtest%shlibext
2016-10-03 05:47:56 +03:00
// RUN: cat %s | %cling -I %S -DENVVAR_LIB="\"%/T/subdir\"" -DENVVAR_INC="\"%/p/subdir\"" -Xclang -verify 2>&1 | FileCheck %s
extern " C " int cling_testlibrary_function ( ) ;
2016-12-14 21:25:34 +03:00
# ifndef _WIN32
# include <stdlib.h>
# else
extern " C " int _putenv_s ( const char * name , const char * value ) ;
2016-10-03 05:47:56 +03:00
# define setenv(n, v, o) _putenv_s(n,v)
# endif
2016-12-14 21:25:34 +03:00
: : setenv ( " ENVVAR_INC " , ENVVAR_INC , 1 ) ;
: : setenv ( " ENVVAR_LIB " , ENVVAR_LIB , 1 ) ;
2015-05-29 19:36:29 +03:00
# pragma cling add_include_path("$ENVVAR_INC")
# include "Include_header.h"
include_test ( )
// CHECK: OK(int) 0
# pragma cling add_library_path("$ENVVAR_LIB")
# pragma cling load("libtest")
2016-10-03 05:47:56 +03:00
cling_testlibrary_function ( )
// CHECK: (int) 66
2015-05-29 19:36:29 +03:00
# pragma cling add_library_path("$NONEXISTINGVARNAME")
//expected-no-diagnostics