From 05097f7717dc3036d2c02f06e81909a8d325b312 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Thu, 7 Feb 2013 13:28:59 +0400 Subject: [PATCH] C: undef_ref added --- c/undef_ref/a.c | 14 ++++ c/undef_ref/test.c | 14 ++++ c/undef_ref/test.def | 150 ++++++++++++++++++++++++++++++++++++++++ c/undef_ref/test_lin.sh | 5 ++ c/undef_ref/test_win.sh | 15 ++++ 5 files changed, 198 insertions(+) create mode 100644 c/undef_ref/a.c create mode 100644 c/undef_ref/test.c create mode 100644 c/undef_ref/test.def create mode 100755 c/undef_ref/test_lin.sh create mode 100755 c/undef_ref/test_win.sh diff --git a/c/undef_ref/a.c b/c/undef_ref/a.c new file mode 100644 index 0000000..9bf214e --- /dev/null +++ b/c/undef_ref/a.c @@ -0,0 +1,14 @@ +#include + +__declspec(dllexport) void DisplayHelloFromDLL() +{ + printf ("Hello from DLL !\n"); +} + +/*#include + +void lib_func () +{ + puts ("lib_func () called ;-)"); + exe_func (); +}*/ diff --git a/c/undef_ref/test.c b/c/undef_ref/test.c new file mode 100644 index 0000000..0a4f6b2 --- /dev/null +++ b/c/undef_ref/test.c @@ -0,0 +1,14 @@ +#include + +exe_func () +{ + puts ("exe_func () called ;-)"); +} + +void main () +{ +#ifdef PLUGINS_ENABLED + puts ("calling lib_func from test.exe..."); + lib_func (); +#endif +} diff --git a/c/undef_ref/test.def b/c/undef_ref/test.def new file mode 100644 index 0000000..134572e --- /dev/null +++ b/c/undef_ref/test.def @@ -0,0 +1,150 @@ +; C:\vala\bin\dlltool.exe -z test.def --export-all-symbol test.exe +EXPORTS + ".weak.__Jv_RegisterClasses.___gcc_register_frame" @ 1 DATA + ".weak.___deregister_frame_info.___gcc_register_frame" @ 2 DATA + ".weak.___register_frame_info.___gcc_register_frame" @ 3 DATA + DeleteCriticalSection@4 @ 4 + EnterCriticalSection@4 @ 5 + ExitProcess@4 @ 6 + GetLastError@0 @ 7 + GetModuleHandleA@4 @ 8 + GetProcAddress@8 @ 9 + InitializeCriticalSection@4 @ 10 + LeaveCriticalSection@4 @ 11 + SetUnhandledExceptionFilter@4 @ 12 + TlsGetValue@4 @ 13 + VirtualProtect@16 @ 14 + VirtualQuery@12 @ 15 + WinMainCRTStartup @ 16 + _CRT_MT @ 17 DATA + _CRT_fmode @ 18 DATA + _CRT_glob @ 19 DATA + _CTOR_LIST__ @ 20 DATA + _DTOR_LIST__ @ 21 DATA + _IAT_end__ @ 22 DATA + _IAT_start__ @ 23 DATA + _RUNTIME_PSEUDO_RELOC_LIST_END__ @ 24 DATA + _RUNTIME_PSEUDO_RELOC_LIST__ @ 25 DATA + __CTOR_LIST__ @ 26 DATA + __DTOR_LIST__ @ 27 DATA + __ImageBase @ 28 DATA + __RUNTIME_PSEUDO_RELOC_LIST_END__ @ 29 DATA + __RUNTIME_PSEUDO_RELOC_LIST__ @ 30 DATA + ___w64_mingwthr_add_key_dtor @ 31 + ___w64_mingwthr_remove_key_dtor @ 32 + __cpu_features @ 33 DATA + __cpu_features_init @ 34 + __crt_xc_end__ @ 35 DATA + __crt_xc_start__ @ 36 DATA + __crt_xi_end__ @ 37 DATA + __crt_xi_start__ @ 38 DATA + __crt_xl_start__ @ 39 DATA + __crt_xp_end__ @ 40 DATA + __crt_xp_start__ @ 41 DATA + __crt_xt_end__ @ 42 DATA + __crt_xt_start__ @ 43 DATA + __do_global_ctors @ 44 + __do_global_dtors @ 45 + __dyn_tls_init@12 @ 46 + __dyn_tls_init_callback @ 47 DATA + __gcc_deregister_frame @ 48 + __gcc_register_frame @ 49 + __getmainargs @ 50 + __main @ 51 + __mingw_TLScallback @ 52 + __p__environ @ 53 + __p__fmode @ 54 + __set_app_type @ 55 DATA + __tlregdtor @ 56 + __tls_end__ @ 57 DATA + __tls_start__ @ 58 DATA + __xl_a @ 59 DATA + __xl_c @ 60 DATA + __xl_d @ 61 DATA + __xl_z @ 62 DATA + _argc @ 63 DATA + _argv @ 64 DATA + _bss_end__ @ 65 DATA + _bss_start__ @ 66 DATA + _cexit @ 67 + _data_end__ @ 68 DATA + _data_start__ @ 69 DATA + _dll__ @ 70 DATA + _dll_characteristics__ @ 71 DATA + _end__ @ 72 DATA + _file_alignment__ @ 73 DATA + _fmode @ 74 DATA + _fpreset @ 75 + _head_libkernel32_a @ 76 DATA + _head_libmsvcrt_a @ 77 DATA + _image_base__ @ 78 DATA + _imp__DeleteCriticalSection@4 @ 79 DATA + _imp__EnterCriticalSection@4 @ 80 DATA + _imp__ExitProcess@4 @ 81 DATA + _imp__GetLastError@0 @ 82 DATA + _imp__GetModuleHandleA@4 @ 83 DATA + _imp__GetProcAddress@8 @ 84 DATA + _imp__InitializeCriticalSection@4 @ 85 DATA + _imp__LeaveCriticalSection@4 @ 86 DATA + _imp__SetUnhandledExceptionFilter@4 @ 87 DATA + _imp__TlsGetValue@4 @ 88 DATA + _imp__VirtualProtect@16 @ 89 DATA + _imp__VirtualQuery@12 @ 90 DATA + _imp____getmainargs @ 91 DATA + _imp____p__environ @ 92 DATA + _imp____p__fmode @ 93 DATA + _imp____set_app_type @ 94 DATA + _imp___cexit @ 95 DATA + _imp___iob @ 96 DATA + _imp___onexit @ 97 DATA + _imp___setmode @ 98 DATA + _imp__abort @ 99 DATA + _imp__atexit @ 100 DATA + _imp__calloc @ 101 DATA + _imp__free @ 102 DATA + _imp__fwrite @ 103 DATA + _imp__memcpy @ 104 DATA + _imp__puts @ 105 DATA + _imp__signal @ 106 DATA + _imp__vfprintf @ 107 DATA + _libkernel32_a_iname @ 108 DATA + _libmsvcrt_a_iname @ 109 DATA + _loader_flags__ @ 110 DATA + _major_image_version__ @ 111 DATA + _major_os_version__ @ 112 DATA + _major_subsystem_version__ @ 113 DATA + _minor_image_version__ @ 114 DATA + _minor_os_version__ @ 115 DATA + _minor_subsystem_version__ @ 116 DATA + _onexit @ 117 + _pei386_runtime_relocator @ 118 + _rt_psrelocs_end @ 119 DATA + _rt_psrelocs_size @ 120 DATA + _rt_psrelocs_start @ 121 DATA + _section_alignment__ @ 122 DATA + _setmode @ 123 + _size_of_heap_commit__ @ 124 DATA + _size_of_heap_reserve__ @ 125 DATA + _size_of_stack_commit__ @ 126 DATA + _size_of_stack_reserve__ @ 127 DATA + _subsystem__ @ 128 DATA + _tls_end @ 129 DATA + _tls_index @ 130 DATA + _tls_start @ 131 DATA + _tls_used @ 132 DATA + abort @ 133 + atexit @ 134 + calloc @ 135 + exe_func @ 136 + fpreset @ 137 + free @ 138 + fwrite @ 139 + main @ 140 + mainCRTStartup @ 141 + memcpy @ 142 + mingw_initltsdrot_force @ 143 DATA + mingw_initltsdyn_force @ 144 DATA + mingw_initltssuo_force @ 145 DATA + puts @ 146 + signal @ 147 + vfprintf @ 148 diff --git a/c/undef_ref/test_lin.sh b/c/undef_ref/test_lin.sh new file mode 100755 index 0000000..5bdce22 --- /dev/null +++ b/c/undef_ref/test_lin.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +gcc -fPIC -shared -o liba.so a.c +gcc test.c -L. -la +LD_LIBRARY_PATH=. ./a.out diff --git a/c/undef_ref/test_win.sh b/c/undef_ref/test_win.sh new file mode 100755 index 0000000..39815a1 --- /dev/null +++ b/c/undef_ref/test_win.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +gcc test.c -o test.exe +dlltool.exe -z test.def --export-all-symbol test.exe +dlltool.exe -U -d test.def -l test.a +gcc -shared -o liba.dll a.c test.a +gcc -DPLUGINS_ENABLED=1 -o test.exe test.c -L. -la +./test.exe + + +#gcc test.c -o test.exe +#dlltool.exe -z test.def --export-all-symbol test.exe +#gcc -shared -o liba.dll a.c test.def +#gcc -DPLUGINS_ENABLED=1 test.c -L. -la +#LD_LIBRARY_PATH=. ./a.out