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

Hi,

> I'm trying to create -hbdyn pcode .dll, but since we've decided 
> to disable Harbour libs in this case, I'm getting failure:
> ---
> undefined reference to `hb_vmExecute'
> undefined reference to `hb_vmProcessSymbols'
> undefined reference to `HB_FUN_QOUT'
> ---

And it's correct behavior. Such PCODE dll can be linked with:

1. harbour shared library (harbour*.dll) and in such case it's enough
   to use -shared hbmk2 parameter.

2. hbmaindll library and in such case all external functions inside
   PRG code should be declared as DYNAMIC to not create any hardcoded
   references to them, i.e.:

      /*** dllcode.prg ***/
      DYNAMIC QOUT, PROCNAME
      proc MY_PROC()
         ? PROCNAME() + ": hello !!!"
      return
      init proc start
         ? "INIT PROC", PROCNAME()
      return
      exit proc end
         ? "EXIT PROC", PROCNAME()
      return

   See my last message about creating DLLs and code to automatically
   generate files with DYNAMIC declarations for all functions linked
   with the main executable part of application.

   I haven't added 'hbstatic' library yet we were talking about so
   you have to link main part of application dynamically or build
   harbour with HB_DYNLIB macro or add this code:
      #pragma begindump
      #include "hbapi.h"
      HB_EXPORT_ATTR PHB_FUNC dll_hb_vmProcAddress( const char * szFuncName )
      {
         return hb_vmProcAddress( szFuncName );
      }
   to one of .prg files linked with main static part of application.

3. with import library created for the main executable part of application
   when it was linked using -implib hbmk2 switch.
   To create such import library you have to compile Harbour with
   HB_DYNLIB macro or if you are using MinGW then you can use
   --export-all-symbols LD switch, i.e.:
      hbmk2 -implib -ldflag=-Wl,--export-all-symbols ...

You cannot link such PCODE DLL with Harbour static libraries.
Technically it's possible and you will not have any link time
errors when you add -nohblib- switch but you will create broken
binaries because your DLL and you static part of application will
use their own independent HVM implementations.
The only one situation when such DLL linked with Harbour static
libraries is usable is when programmer wants to create self contain
DLL which will be used by non Harbour applications.

> If I add -lhbmaindllp manually, I'm stil getting
> ---
> undefined reference to `HB_FUN_QOUT'
> ---
> What am I missing?

See above.

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