Problems with dynamic linking in tela
Hi,
I have tried to compile and link the following file into tela. The
--shared version works if I remove the line with "cout <<". Do you
have any advise on what can be the problem? Tela uses dlopen() to
load the file.
TIA,
Micce
~/tmp$cat myfn.ct
// Our first C-tela example
[] = myfn(x)
/* myfn(x) checks that x is a positive scalar and outputs it.
Error codes:
1: x is not a positive scalar */
{
if (!x.IsScalar()) return 1;
switch (x.kind()) {
case Kint:
if (x.IntValue() <= 0) return 1;
break;
case Kreal:
if (x.RealValue() <= 0) return 1;
break;
case Kcomplex:
return 1;
default:
return 1;
}
cout << "myfn: x = " << x << '\n';
return 0;
}
~/tmp$telakka --shared myfn.ct
~/tmp$telakka -c myfn.ct
~/tmp$ls -l
totalt 12k
-rw-rw-r-- 1 micce micce 529 aug 2 16:08 myfn.ct
-rw-rw-r-- 1 micce micce 1.6k aug 2 16:09 myfn.o
-rwxrwxr-x 1 micce micce 3.2k aug 2 16:08 myfn.so*
~/tmp$tela
This tela is a tensor language, Version 1.32.
Type ?help for help.
->TAB completion works; try docview() and source("demo")
>link("myfn.o")
./myfn.o: ELF file's phentsize not the expected size
Warning from C-function 'link':
Cannot link-load file.
>link("myfn.so")
./myfn.so: undefined symbol: __ls__FR7ostreamRC7Tobject
Warning from C-function 'link':
Cannot link-load file.
>71 instructions, 0 arithmetic ops.
0.000788889 MIPS, 0 MFLOPS.
~/tmp$
--
Mikael Hedin, MSc +46 (0)980 79176
Swedish Institute of Space Physics +46 (0)8 344979 (home)
Box 812, S-981 28 KIRUNA, Sweden +46 (0)70 5891533 (mobile)
[gpg key fingerprint = 387F A8DB DC2A 50E3 FE26 30C4 5793 29D3 C01B 2A22]
Reply to: