On Tue, 09 Feb 2010, Szak�ts Viktor wrote:

Hi,

> Minor note: -cflag=-DHB_DYNLIB is automatically enabled for non-mingw 
> compilers when -hbdyn is used, so it's not necessary to add it manually.

Thank you for the information.

> I believe the rest of this nice description should definitely go into 
> doc/pcodedll.txt. You can even commit as is.

I'll try to create it but 1-st I would like to update the code
to describe final version.

I've looked closer at current code and also made some tests using MinGW,
OpenWatcom and BCC55 with HBMK2 in my Linux box.
Here are things I collected.

1. -implib in MinGW and OpenWatcom builds uses "{OI}" as import
   library name. In BCC builds it works OK. I haven't tested other
   builds
2. -hbdyn should automatically disable all static harbour
   libraries (-nohblib) but it should be possible to enable
   shared harbour library using -*shared option.
   I do not see any normal situation when harbour static libraries
   can be linked with PCODE shared library. It's usable only when
   user wants to create his own custom harbour*.dll replacement so
   rather very seldom. In such he can enable static libraries explicitly
   or using -nohblib-. But in all other cases linking static libraries
   will cause that the same code is replicated in PCODE DLL and final
   application with all internal structures like HVM stack so usually
   broken binaries are created.
3. Why have we these lines:
      # always export symbols
      HB_CFLAGS += -DHB_DYNLIB
   in src/vm/maindllp/Makefile? Which C compiler does need it?
   It breaks autoexport functionality in MinGW builds.
   I also do not see any reason to export wrappers to real functions.
4. Why have we these lines:
      # always export symbols
      HB_CFLAGS += -DHB_DYNLIB
   in src/vm/maindllh/Makefile?
5. Why do we keep src/vm/maindll.c?
   IMO it should be removed.
6. It's time to create from scratch new maindllp.c which will work using
   internal HVM function to extract function addresses and will report
   errors if some functions are not available.
   From current code I'll take your macros for harbour*dll names and
   create completely new implementation in src/vm/maindllp/ directory.
   At the beginning I'll add support only for hb_vmProcessSymbols()
   and hb_vmExecute().
   Later we can add wrappers also two other functions, i.e. the ones
   which are present in current maindllp.c (I'll left it as reference
   file for some time).
7. It's necessary to add to HBMK2 link time option which add this
   code to final binaries:
      #include "hbapi.h"
      HB_EXPORT_ATTR PHB_FUNC dll_hb_vmProcAddress( const char * szFuncName )
      {
         return hb_vmProcAddress( szFuncName );
      }
   I'll update Harbour header files and add HB_EXPORT_ATTR and
   hb_vmProcAddress() declaration to them.
   We only have to choose name for this new option.
   My propositions: -hasdyn or -usedyn -expdyn
   Sorry but I'm the last person for such jobs but I believe that other
   users can help us.

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to