提交 5641360b 编写于 作者: P prife

simulator: add createdef.py to generate def file for VS

Now we can get rid off Mingw to create def file. To create def file, one
should run:

    scons --def

in the bsp/simulator.
上级 ca9b83c6
......@@ -122,13 +122,12 @@ if GetDepend('RT_USING_MODULE'):
default=False,
help='create rthread.def of rtthread.dll on windows')
if GetOption('def'):
if rtconfig.PLATFORM != 'mingw':
print "scons error: `--def' can only work with mingw"
exit(1)
if rtconfig.PLATFORM == 'mingw':
env['LINKFLAGS'] = rtconfig.DEFFILE_LFLAGS
else:
rtconfig.POST_ACTION = 'createdef.py $TARGET rtthread.def'
env['LINKFLAGS'] = rtconfig.DEFFILE_LFLAGS
env.SharedLibrary("rtthread.dll", objs)
program = ''
program = env.Program(TARGET, objs)
else:
if rtconfig.PLATFORM == 'cl':
objs += ['rtthread.def']
......
import re
import sys
fsrc = "rtthread.dll"
fname ="rtthread.def"
prefix = "__vs_rtm_"
if len(sys.argv) >= 2:
fsrc = sys.argv[1]
fname = sys.argv[2]
#restr = r"__vs_rtm_.*?\0"
restr = prefix + r".*?\0"
s = open(fsrc, 'rb').read()
l = re.findall(restr, s, re.S)
lines = [i[len(prefix):-1] for i in l]
s = '\n'.join(lines)
fout = open(fname, 'w')
fout.write('EXPORTS\n')
fout.write('main\n')
fout.write(s)
......@@ -128,7 +128,7 @@ void rt_module_unload_sethook(void (*hook)(rt_module_t module))
*
* This function will initialize system module
*/
void rt_system_module_init(void)
int rt_system_module_init(void)
{
}
......
此差异已折叠。
......@@ -31,8 +31,15 @@ struct rt_module_symtab
const char *name;
};
#if defined(_MSC_VER) || defined(__MINGW32__)
#if defined(_MSC_VER)
#pragma section("RTMSymTab$f",read)
#define RTM_EXPORT(symbol) \
__declspec(allocate("RTMSymTab$f"))const char __rtmsym_##symbol##_name[] = "__vs_rtm_"#symbol;
#pragma comment(linker, "/merge:RTMSymTab=mytext")
#elif defined(__MINGW32__)
#define RTM_EXPORT(symbol)
#else
#define RTM_EXPORT(symbol) \
const char __rtmsym_##symbol##_name[] = #symbol; \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册