Closed daokoder closed 9 years ago
Doesn't work on Windows. I get overwhelmed by undefined references.
Sample output when building time
:
gcc DaoMake.Objs/dao_time.c.D51B.o -ggdb -shared-libgcc -Wl,-rpath=../../../bin/
-L../../bin/ -lwinmm -Wl,-rpath=/usr/local/lib -ldao -shared -shared-libgcc -Wl
,--out-implib,libdao_time.dll -o ../../lib/dao/modules/dao_time.dll
DaoMake.Objs/dao_time.c.D51B.o: In function `DaoTime_OnLoad':
c:\Dao\modules\time/../auxlib/../time/dao_time.h:65: undefined reference to `_im
p___DaoMkTimeUtc'
c:\Dao\modules\time/../auxlib/../time/dao_time.h:66: undefined reference to `_im
p___DaoTime_GetParts'
c:\Dao\modules\time/../auxlib/../time/dao_time.h:67: undefined reference to `_im
p___DaoProcess_PutTime'
c:\Dao\modules\time/../auxlib/../time/dao_time.h:68: undefined reference to `_im
p___DaoProcess_NewTime'
collect2.exe: error: ld returned 1 exit status
Fixed.
Now random
also requires fixing.
gcc DaoMake.Objs/dao_random.c.17C8.o -ggdb -shared-libgcc -Wl,-rpath=../../../bi
n/ -L../../bin/ -lwinmm -Wl,-rpath=/usr/local/lib -ldao -shared -shared-libgcc -
Wl,--out-implib,libdao_random.dll -o ../../lib/dao/modules/dao_random.dll
DaoMake.Objs/dao_random.c.17C8.o: In function `DaoRandom_OnLoad':
c:\Dao\modules\random/../auxlib/../random/dao_random.h:49: undefined reference t
o `_imp___DaoRandGenerator_New'
c:\Dao\modules\random/../auxlib/../random/dao_random.h:50: undefined reference t
o `_imp___DaoRandGenerator_Delete'
c:\Dao\modules\random/../auxlib/../random/dao_random.h:51: undefined reference t
o `_imp___DaoRandGenerator_Seed'
c:\Dao\modules\random/../auxlib/../random/dao_random.h:52: undefined reference t
o `_imp___DaoRandGenerator_GetUniform'
c:\Dao\modules\random/../auxlib/../random/dao_random.h:53: undefined reference t
o `_imp___DaoRandGenerator_GetNormal'
collect2.exe: error: ld returned 1 exit status
Ok, random
was modified on Mac, but it requires a minor change in its makefile.dao
to support proxy api on Windows. Now done.
Now it's OK.
How will be handled the (very) common case of compiling some external/downstream modules (i.e. not modules from standard library) depending on some module(s) in standard library without modifying and recompiling the aux module?
How will be handled the (very) common case of compiling some external/downstream modules (i.e. not modules from standard library) depending on some module(s) in standard library without modifying and recompiling the aux module?
Should be handled in the same way, because the building dependency is only on the aux
module and it is compiled with all the proxy APIs of all the supported standard modules.
I suppose the feature more or less stabilized, so the issue can be closed.
Recent introduction of module
stream
has created several inter-module dependencies. More such dependencies can be expected when modules such astime
andrandom
get more used by other modules. So I tried to introduce a new feature to reduce such dependencies.The idea is to create proxy APIs in the form of function pointers for commonly used modules. These APIs (function pointers) are defined in the
aux
module. These function pointers are set properly when the actual module is loaded. Other modules only need to have dependency onaux
, in order to use the proxy APIs.Now the
aux
module is built as a part of theDao
project, so all modules will automatically have dependency onaux
as well, and users do not need to do anything about it for building. At running time, theaux
module is loaded automatically when any dll module is loaded for the first time. This way the running time dependency is also resolved.The only caveat is that all the proxy APIs are prefixed with
_
.Please see
stream
,time
andimage
for examples.