10
10
#include < complex>
11
11
#include < sstream>
12
12
#include < iterator>
13
+ #include < cstdio>
14
+ #include < cstdlib>
13
15
14
16
#include < libasr/asr.h>
15
17
#include < libasr/asr_utils.h>
@@ -372,14 +374,22 @@ ASR::Module_t* load_module(Allocator &al, SymbolTable *symtab,
372
374
input.clear ();
373
375
found = set_module_path (infile0, rl_path, infile,
374
376
path_used, input, ltypes, enum_py);
375
- } else {
377
+ } else {
376
378
if ( !is_compilation_needed (infile) ) {
377
379
mod1 = load_pycfile (al, input, false );
378
380
fix_external_symbols (*mod1, *ASRUtils::get_tu_symtab (symtab));
379
381
LFORTRAN_ASSERT (asr_verify (*mod1));
380
382
compile_module = false ;
381
383
} else {
382
384
infile.pop_back ();
385
+ std::string cmd = " lpython -c --disable-main " + infile;
386
+ system (cmd.c_str ());
387
+ bool found = set_module_path (infile0c, rl_path, infile,
388
+ path_used, input, ltypes, enum_py);
389
+ mod1 = load_pycfile (al, input, false );
390
+ fix_external_symbols (*mod1, *ASRUtils::get_tu_symtab (symtab));
391
+ LFORTRAN_ASSERT (asr_verify (*mod1));
392
+ compile_module = false ;
383
393
}
384
394
}
385
395
@@ -393,7 +403,14 @@ ASR::Module_t* load_module(Allocator &al, SymbolTable *symtab,
393
403
if (ltypes) return nullptr ;
394
404
395
405
if ( compile_module ) {
396
- mod1 = compile_module_till_asr (al, rl_path, infile, loc, err);
406
+ // mod1 = compile_module_till_asr(al, rl_path, infile, loc, err);
407
+ std::string cmd = " lpython -c --disable-main " + infile;
408
+ system (cmd.c_str ());
409
+ bool found = set_module_path (infile0c, rl_path, infile,
410
+ path_used, input, ltypes, enum_py);
411
+ mod1 = load_pycfile (al, input, false );
412
+ fix_external_symbols (*mod1, *ASRUtils::get_tu_symtab (symtab));
413
+ LFORTRAN_ASSERT (asr_verify (*mod1));
397
414
}
398
415
399
416
// insert into `symtab`
0 commit comments