Roberto,
I did some tests with HMG/WEB Alpha 012 + NETIO.
HMG + NETIO works fine but combining with HMG/WEB Alpha 012 gives an runtime-error:
TEST.cgi - Entrypoint not found
Unable to find entrypoint of procedure hb_fileRegister in DLL-file harbour-32.dll
What I did:
1) HMG app with NETIO (See Connect_NetServer() and USERSDBF()... : works OK
2) Server application with several queries (see Q_USERS()) which are called from HMG app: works OK
3) Index.html with TEST.CGI which calls also Server-app-query Q_USERS: gives runtime-error.
4) Index.html with TEST.CGI which has a copy of Q_USERS: works OK.
So I can't get NETIO working with CGI. Harbour-32.dll is located in the same folder as the CGI modules.
Any idea how to fix this?
Serge
See source-snippets:
PRG-CGI module
Code: Select all
/* build.bat :
**************
@ECHO OFF
CLS
SET HBPATH=C:\harbour\bin
SET HMGINCPATH=c:\hmgweb\include
SET APACHECGIPATH=c:\hmgweb\apache\cgi-bin
%HBPATH%\hbmk2 %1 -i%HMGINCPATH% hbmysql.hbc hbmisc.hbc hbnetio.hbc hbct.hbc -shared
IF ERRORLEVEL 0 MOVE %1.exe %APACHECGIPATH%\%1.cgi
*/
// TEST.PRG --> TEST.CGI ------------------------------------------------------
#include "hmg.ch"
#include "error.ch"
#include "common.ch"
#require "hbnetio"
REQUEST HB_GT_CGI_DEFAULT
REQUEST HB_GT_WIN_DEFAULT
FUNCTION MAIN()
/**************/
LOCAL aQuery := {}
PUBLIC cNetServer := '127.0.0.1' // local server or any addres (even Internet)
PUBLIC nNetPort := 2941 // you can choose any you want
PUBLIC cNetPass := 'something_secret' // Idem
PUBLIC _HMG_SYSDATA_ [ 32 ]
cQUERY := getvalue("url")
cWHERE := getvalue("where")
// requested query existing eg: Q_USERS
IF !Connect_NetServer()
xSUR_NAME := ''
xFAM_NAME := ''
ELSE
aQuery := netio_funcexec( cQUERY, cWHERE )
xSUR_NAME := ALLTRIM(aQuery[1] [1] )
xFAM_NAME := ALLTRIM(aQuery[1] [2] )
netio_disconnect( cNetServer , nNetPort )
ENDIF
OutStd( "Content-type: text/html" + hb_OSNewLine() + hb_OSNewLine() )
OutStd( '<br> ' )
OutStd( xSUR_NAME + ' ' + xFAM_NAME + '<br> ' )
/* ok
aAr := Q_USERS()
xSUR_NAME := ALLTRIM(aAr [1] [1] )
xFAM_NAME := ALLTRIM(aAr [1] [2] )
OutStd( "Content-type: text/html" + hb_OSNewLine() + hb_OSNewLine() )
OutStd( '<br> ' )
OutStd( xSUR_NAME + ' ' + xFAM_NAME + '<br> ' ) */
RETURN NIL
FUNCTION Connect_NetServer()
/**************************/
LOCAL c_STR_Con := "net:"
lConnect := netio_connect( cNetServer , nNetPort ,, cNetPass, 9 )
IF .Not. lConnect
RETURN .F.
ENDIF
RETURN .T.
// TEST.PRG --> TEST.CGI ------------------------------------------------------
HMG App
Code: Select all
FUNCTION Connect_NetServer()
/**************************/
LOCAL c_STR_Con := "net:"
lConnect := netio_connect( cNetServer , nNetPort ,, cNetPass, 9 )
IF .Not. lConnect
RETURN .F.
ENDIF
RETURN .T.
// TEST.PRG --> TEST.CGI ------------------------------------------------------
FUNCTION USERSDBF()
/*******************/
cWHERE := ''
IF !Connect_NetServer()
xSUR_NAME := ''
xFAM_NAME := ''
ELSE
aQuery := netio_funcexec( 'Q_USERS', cWHERE )
xSUR_NAME := ALLTRIM(aQuery[1] [1] )
xFAM_NAME := ALLTRIM(aQuery[1] [2] )
netio_disconnect( cNetServer , nNetPort )
ENDIF
MSGINFO(xSUR_NAME, 'xSUR_NAME')
RETURN
SERVER Function
Code: Select all
/*************************************************************************/
/* Q_USERS is located within HMGSERVERIO.PRG */
/* When calling netio_funcexec( 'Q_USERS', '' ) from a HMG Application */
/* (function USERSDBF) this works fine. */
/* */
/* When calling from TEST.CGI it gives a runtime-error: */
/* TEST.cgi - Entrypoint not found */
/* Unable to find entrypoint of procedure hb_fileRegister in DLL-file */
/* harbour-32.dll. */
/* (see att. ) */
/*************************************************************************/
FUNCTION Q_USERS()
/**************************************/
LOCAL a, aRecordset := {}, aFIELD := {}
PARAMETERS cWHERE
USE USERFILE
IF!EMPTY(cWHERE)
SET FILTER TO FAM_NAME == cWHERE
ENDIF
GO TOP
DO WHILE .NOT. EOF()
aFIELD := {}
FOR a = 1 to fcount()
AADD(aFIELD , fieldGet(a) )
NEXT a
AADD( aRecordset , aFIELD )
SKIP
ENDDO
USE
RETURN aRecordset
Greetings and thanks, Serge