lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Philippe Verdy once stated:
> Le sam. 24 nov. 2018 à 23:20, Sean Conner <sean@conman.org> a écrit :
> 
> >         >cl /c main.c
> >         >cl /c func1.c
> >         >cl /c func2.c
> >         >cl /c myfunc2.c
> >         >link /dll /out:mylib.dll func1.obj func2.obj
> >           Creating library mylib.lib and object mylib.exp
> >         >link /out:main.exe main.obj myfunc2.obj mylib.lib
> >         >main
> >         Hello from main
> >                 Hello from func1
> >                         Hello from func2
> >                 Back to func1
> >         Back to main
> >                         Hello from myfunc2
> >         Back to main
> >
> > Which is different from what I saw on Linux and Solaris in the same
> > scenario:
> >
> >         Hello from main
> >         Hello from func1
> >         Hello from myfunc2
>
> This last is certainly not the same scenario ! My scenario made it clear
> which version was used by testing not the two calls only from main, but
> also testing the second function when it is called from the 1st one.

  Okay.

	% uname
	Linux
	% cc    -c -o main.o main.c
	% cc    -c -o myfunc2.o myfunc2.c
	% cc -shared -fPIC -o func.ss func.c
	% ar rv libfuncall.so func.ss
	% ar: creating libfuncall.so
	% a - func.ss
	% cc  -Wl,-rpath,/tmp/foo -o smain2 main.o myfunc2.o libfuncall.so 
	% ./smain2 
	Hello from main
	        Hello from func1
	                Hello from myfunc2
	        Back to func1
	Back to main
	                Hello from myfunc2
	Back to main

  Happy now?

> There's no such limitation and portability issue when you don't use ANY
> static library but only use "prelinked" shared libraries (like DLL on
> windows or ELF libraries on Linux.. note that executable and DLL modules on
> Windows, as well as on OS/2, are based on directly on the ELF format) !

  Citation needed.

  -spc