On Wed, 10 Feb 2010, 2D Info - Leandro Damasio wrote:
Hi,
> >-implib for -hbexe is okay, I'll commit it. For the other,
> >I'd prefer to suggest -ldflag=--export-all-symbols until we find
> >at least one more target which supports this option.
> Probably I've lost you, but does this flag (--export-all-symbols)
> supress the need of using DYNAMIC clause on exe program shared
> functions declaration?
Not exactly. --export-all-symbols is MinGW linked option which
caused that all public symbols in final executable file and/or
in DLL library are exported. When you are creating your standalone
EXE file you can use it with -implib option to create import
library which will contain wrappers to all public functions in
your EXE file.
Then when you are creating DLLs which are loaded by your program
(remember to use HB_LIBLOAD()/HB_LIBFREE() not some other hbwin
replacement) then you can use this library to link such DLLs.
All public functions inside your EXE file will have references
in import library so you will not have to use DYNAMIC or any
other tricks in your code. Just simply during linking you are
replacing 'hbmaindllp' with import library generated for your
EXE file. Just try. You can distribute such import library to
all programmers writing DLL extensions to your EXE. Using it
they can easy verify which functions are available.
Please only remember that it's LD option (MinGW linker) so
it should be specified with -Wl, prefix. If you are using
hbmk2 then you should use "-ldflag=-Wl,--export-all-symbols"
and "-implib" as hbmk2 parameter when you are linking your
EXE file.
But in the .prg code used for EXE file when you are calling
functions which do not exist in it and are loaded dynamically
then all such functions should be declared as DYNAMIC otherwise
you will have link time error (function does not exist).
best regards,
Przemek
ps. current HBMK2 does not add 'lib' prefix to generated import
library name. I hope it will be fixed ASAP. Meanwhile simply
rename it manually.
When you are linking DLL or EXE file then you can specify
all libraries using -l<name> where name does not contain
'lib' prefix and '.a' extension -L<path> to specify path
where your libraries are located. By default current path
is not searched so if you want to use it then you should
add '-L.' switch.
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour