FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How create DLL With XHARBOUR
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM

How create DLL With XHARBOUR

Posted:

Mr. Antonio

Thank you very much for the "BuildHd.bat" and the new xHarbour build.

When I try to build any application with the new xHarbour version, I am gettng the following errors!.

Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_hb_stack' referenced from C:\FWH\LIB\FIVEHC.LIB|FFWNDRUN
Error: Unresolved external '_hb_sxDeCrypt' referenced from C:\XHARBOUR\LIB\RDD.LIB|dbf1
Error: Unresolved external '_hb_sxPtoD' referenced from C:\XHARBOUR\LIB\RDD.LIB|dbf1
Error: Unresolved external '_hb_sxDtoP' referenced from C:\XHARBOUR\LIB\RDD.LIB|dbf1
Error: Unresolved external '_hb_sxEnCrypt' referenced from C:\XHARBOUR\LIB\RDD.LIB|dbf1

Am I missing any thing in the "BuildHd.bat"

I give below the copy of "BuildHd.bat" for your reference.

@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for Harbour 2.7 - January 2006 Harbour development power ³Ü
ECHO ³ (c) FiveTech, 1993-2005 for Microsoft Windows 95/98/NT/2000/ME and XP ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

ECHO Compiling...

set hdir=c:\xharbour
set bcdir=c:\bcc55

%hdir%\bin\harbour %1 /n /i..\include;%hdir%\include /w /p %2 %3 > clip.log
@type clip.log
IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO EXIT

echo -O2 -I%hdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c @b32.bc
:ENDCOMPILE

IF EXIST %1.rc %bcdir%\bin\brc32 -r %1

echo c0d32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.dll, + >> b32.bc
echo %1.map, + >> b32.bc
echo c:\fwh\lib\FiveH.lib c:\fwh\lib\FiveHC.lib + >> b32.bc
echo %hdir%\lib\rtl.lib + >> b32.bc
echo %hdir%\lib\vm.lib + >> b32.bc
echo %hdir%\lib\gtwin.lib + >> b32.bc
echo %hdir%\lib\lang.lib + >> b32.bc
echo %hdir%\lib\macro.lib + >> b32.bc
echo %hdir%\lib\rdd.lib + >> b32.bc
echo %hdir%\lib\dbfntx.lib + >> b32.bc
echo %hdir%\lib\dbfcdx.lib + >> b32.bc
echo %hdir%\lib\dbfdbt.lib + >> b32.bc
echo %hdir%\lib\dbffpt.lib + >> b32.bc
echo %hdir%\lib\debug.lib + >> b32.bc
echo %hdir%\lib\common.lib + >> b32.bc
echo %hdir%\lib\pp.lib + >> b32.bc
echo %hdir%\lib\codepage.lib + >> b32.bc

rem Uncomment these two lines to use Advantage RDD
echo %hdir%\lib\rddads.lib + >> b32.bc
echo %hdir%\lib\Ace32.lib + >> b32.bc

echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib, >> b32.bc
IF EXIST %1.res echo %1.res >> b32.bc
%bcdir%\bin\ilink32 -Tpd -aa @b32.bc

rem delete temporary files
@del %1.c
@del %1.il?

IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * self contained DLL successfully built
GOTO EXIT
ECHO

:LINKERROR
rem if exist meminfo.txt notepad meminfo.txt
rem PAUSE * Linking errors *
GOTO EXIT

:SINTAX
ECHO SYNTAX: Build [Program] {-- No especifiques la extensi¢n PRG
ECHO {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT

Please correct me where I am going wrong.

Please also note that "maindll.obj" is not included in the above file.
Is it still required to be included in the above "BuildHd.bat" file, to build the DLL ?

Regards,

  • Ramesh Babu P
Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Sun Dec 11, 2005 10:06 PM

HI Friend´s

How create Dll WITH xharbour..

the ILINK32 display error non public Function

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How create DLL With XHARBOUR

Posted: Sun Dec 11, 2005 10:30 PM

Mauricio,

What kind of DLL do you want to create ? There are three types:

  1. Self contained DLLs: Its an entire EXE built as a DLL.

  2. pcode DLLs: Small pcode DLLs accessible from an EXE.

  3. Virtual machine DLLs: The entire virtual machine is inside the DLL and the EXE is small and contains just the pcode.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Sun Dec 11, 2005 10:36 PM

THANKS ANTONIO..

i need create one DLL to USING FIVEWIN FUNCTIONS VIA COBOL..

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How create DLL With XHARBOUR

Posted: Mon Dec 12, 2005 07:31 AM
Mauricio,

Please read this Harbour's doc:

/*
 * $Id: windll.txt,v 1.1 2002/12/28 00:32:44 brianhays Exp $
 */

Windows 32-bit DLLs with Harbour code
=====================================

Programs created with Clipper or Harbour are traditionally a
monolithic EXE containing all executable code.  This includes
the Virtual Machine (VM) and the RunTime Library (RTL) as well as
your own code.  Running under Windows (Win32) with Harbour, you
can now also create and use Windows DLLs that contain PRG code.

Harbour supports Win32 DLLs in 3 ways.

  1) Self-contained DLLs containing functions from any platform.
     (These are not what we call a "Harbour.dll", although they may
     be named that. The DLL entry points are different.)
     These have the VM/RTL inside them and can be used by any other
     Windows program. You can create a .lib for static linking,
     or use GetProcAddress as in any standard Win32 DLL.
     Calling Harbour/Prg functions directly is limited to
     those that take no parameters unless you include C functions
     in the DLL that take parameters and then call the PRG-level
     code.

     To do static linking, do this to create the .lib:
        implib harbour.lib harbour.dll
     For the Borland C platform, use that library and import32.lib
     and cw32.lib from Borland, and you are ready to go.

     See contrib\delphi\hbdll for an example of a Delphi program that can
     use all of Harbour's functionality by accessing a self-contained DLL.
     BLD_SDLL.BAT is used there to create the DLL.


  2) PCode EXEs using a Harbour.dll

     A Harbour.dll is designed to be called from a Harbour app.
     A pcode EXE is a small Harbour executable that does not contain the
     VM/RTL. To execute its functions, it must load and access a
     Harbour.dll.
     If you want dynamic linking, then use this to execute a Harbour
     dynamically loaded pcode DLL function or procedure:
        HB_DllDo( <cFuncName> [,<params...>] ) --> [<uResult>]

     This lets you have all your common code in a DLL, and have lots
     of small EXEs that use it.  Realize however that, even though this
     may be a nice way to manage your code, each EXE may
     load its own image of the Harbour.dll into memory at runtime.
     In terms of Windows memory, there may not be a benefit to using pcode
     EXEs over monolithic EXEs. But it may be a worthwhile maintenance
     benefit to have lots of replaceable small exes.

  3) PCode DLLs used from traditional EXEs
     A pcode DLL does not contain the VM/RTL.
     It is a library of Harbour-compiled PRG code that uses the VM/RTL
     of the EXE that calls it.  This has the benefit of having
     replaceable modules in DLLs that don't necessarily require updating
     your EXE.


The following is clipped from a msg by Antonio Linares to the Harbour
developer list explaining some of the details:

Please notice that there are three different Windows DLL entry points:
   + source/vm/
   * maindll.c     Windows self-contained DLL entry point
   * maindllh.c    Windows Harbour DLL entry point  (harbour.dll)
   * maindllp.c    Windows pcode DLL entry point and VM/RTL routing functions

   >    * maindll.c     Windows self-contained DLL entry point
   To produce Harbour code, as DLLs, that may be used
   from other programming languages applications (as VB,
   Delphi, C++, etc...)

   >    * maindllh.c    Windows Harbour DLL entry point  (harbour.dll)
   To produce Harbour.dll, to be just used from small pcode Harbour EXEs

   >    * maindllp.c    Windows pcode DLL entry point and VM/RTL routing
   To produce small pcode DLLs, to be used just from Harbour EXE apps.
   maindllp.c is the entry point for the Harbour pcode DLLs. pcode DLLs
   are quite small DLLs, that just contain pcode and/or C (using extend
   api) functions.

   mainwin.c is the entry point for Windows EXEs, not for DLLs.

   You may use maindll.c, maindllh.c or maindllp.c based on
   your needs.

   If you are looking to build a Harbour.dll, then you must use
   maindllh.c
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Mon Dec 12, 2005 10:09 AM

THANKS ANTONIO.

I need self-contained DLL´s ..

Thanks Again

mauricio

Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Mon Dec 12, 2005 10:31 AM

Where Search the Delphi Samples ?

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How create DLL With XHARBOUR

Posted: Mon Dec 12, 2005 11:30 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Mon Dec 12, 2005 11:37 AM

thanks again , antonio...

mauricio

Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Mon Dec 12, 2005 12:38 PM

dear antonio,

Bld_sdll.bat using errorsys.c  , may I using generate C VIA xharbour  With errorsys.prg ...

That´s Right ?

mauricio

Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Mon Dec 12, 2005 02:32 PM

DEAR antonio..

How call the function MakeIndex() VIA DLL32 Command "fivewin".

Mauricio

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How create DLL With XHARBOUR

Posted: Tue Dec 13, 2005 11:40 AM

Mauricio,

You should do some little tests and read the docs I provided you, before going for this. It is not very easy and it requires to know well several concepts before implementing it.

The DLL has to be built with a special entry point, not the standard one provided by Harbour. Then the function has to be declared as exported. Finally you need to load the DLL and check if it loads properly. Then you may try to use the function.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Wed Dec 14, 2005 01:50 AM

THANKS ANTONIO.

I´M DOING YET , OK

thanks again ,
mauricio

Posts: 78
Joined: Fri Dec 02, 2005 06:55 PM

How create DLL With XHARBOUR

Posted: Mon Dec 19, 2005 04:28 PM

Where have Samples More About DLL Xharbour ?

mauricio

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

How create DLL With XHARBOUR

Posted: Mon Dec 19, 2005 04:40 PM

Mauricio,

You may ask at news://news.xharbour.org also.

FWH provides some samples, but mostly for pcode DLLs in samples\TestDllp.prg

regards, saludos

Antonio Linares
www.fivetechsoft.com