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 Viacheslav Usov once stated:
> 
> We have an elephant in the room here, and let me just name it: Windows.
> Once somebody demonstrates similar techniques on Windows, we could talk
> about real-world portability.

  Ivan Krylov ran a similar experiment on Windows, and with static linking,
each function in its own translation unit and turned into a library.  Then
Ivan got the following results:

	>cl /c main.c
	>cl /c func1.c
	>cl /c func2.c
	>cl /c myfunc2.c
	>lib /out:func.lib func1.obj func2.obj
	>link /out:main.exe main.obj myfunc2.obj func.lib
	>main.exe
	main
	func1
	myfunc2

  Which matches what I saw on Linux and Solaris in the same scenario.  He
then did it with shared objects (DLLs), each function in its own translation
unit before making it into a shared library, on Windows:

	>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

  -spc