Can link against shared libraries.

This commit is contained in:
Jussi Pakkanen 2013-01-06 18:40:32 +02:00
parent 216a8ca1ea
commit b9f3ab1c48
4 changed files with 17 additions and 4 deletions

View File

@ -70,13 +70,13 @@ class ShellGenerator():
outfile.write('\necho Compiling \\"%s\\"\n' % src)
outfile.write(' '.join(quoted) + ' || exit\n')
return abs_obj
def build_target_link_arguments(self, deps):
args = []
for d in deps:
if not isinstance(d, interpreter.StaticLibrary):
print(d)
raise RuntimeError('Only static libraries supported ATM.')
if not isinstance(d, interpreter.StaticLibrary) and\
not isinstance(d, interpreter.SharedLibrary):
raise RuntimeError('Tried to link with a non-library target "%s".' % d.get_basename())
args.append(self.get_target_filename(d))
return args

View File

@ -0,0 +1,5 @@
project('shared library linking test')
language('c')
lib = shared_library('mylib', 'libfile.c')
exe = executable('prog', 'main.c')
exe.link(lib)

View File

@ -0,0 +1,3 @@
int func() {
return 0;
}

View File

@ -0,0 +1,5 @@
int func();
int main(int argc, char **arg) {
return func();
}