@@ -32,7 +32,7 @@ import string_list;
3232import c_errno local;
3333import libc_dirent local;
3434import stdio;
35- import stdlib;
35+ import stdlib local ;
3636import string;
3737
3838fn Kind convertKind(build_target.Kind kind) {
@@ -62,11 +62,11 @@ fn void Compiler.onLib(void* arg, u32 name, build_target.Kind kind) {
6262 Compiler* c = arg;
6363 if (kind == DynamicLibrary && c.is_image) {
6464 console.error("images cannot use dynamic libraries");
65- stdlib. exit(-1 );
65+ exit(EXIT_FAILURE );
6666 }
6767 if (c.target.getNoLibC() && name == c.libc_name) {
6868 console.error("cannot use libc and have nolibc");
69- stdlib. exit(-1 );
69+ exit(EXIT_FAILURE );
7070 }
7171 c.mainComp.addDep(name);
7272 c.createComponent(name, convertKind(kind));
@@ -115,7 +115,7 @@ fn void Compiler.open_lib(Compiler* c, Component* comp) {
115115 char[file_utils.Max_path] libdir;
116116 if (!c.find_lib(libstr, libdir, elemsof(libdir))) {
117117 console.error("cannot find library '%s'", libstr);
118- stdlib. exit(-1 );
118+ exit(EXIT_FAILURE );
119119 }
120120
121121 char[file_utils.Max_path] fullname;
@@ -129,7 +129,7 @@ fn void Compiler.open_lib(Compiler* c, Component* comp) {
129129 string_list.List mods.init(c.astPool);
130130 bool ok = manifest.parse(c.sm, file_id, c.astPool, c.auxPool, comp, &mods);
131131 if (!ok) {
132- stdlib. exit(-1 );
132+ exit(EXIT_FAILURE );
133133 }
134134
135135 for (u32 i=0; i<mods.length(); i++) {
@@ -148,10 +148,11 @@ fn void Compiler.open_lib(Compiler* c, Component* comp) {
148148
149149 if (c.target.getNoLibC() && depname == c.libc_name) {
150150 console.error("cannot use %s since it depends on unused libc", comp.getName());
151- stdlib. exit(-1 );
151+ exit(EXIT_FAILURE );
152152 }
153- // Note: for now only support dynamic lib dependencies here
154- c.createComponent(depname, DynamicLibrary);
153+ // TODO The dep should not be specified here, but chosen by end-user.
154+ // if not chosen explicitly by end-user, prefer Dynamic > Static > Source
155+ c.createComponent(depname, ExternalDynamicLib);
155156 }
156157}
157158
0 commit comments