Page 1 of 2

NETIO RPC

Posted: Sun Jul 11, 2010 10:45 am
by karweru
Hi friends,

Encouraged by recent posts in this forum, especially by Rathi, I have decided to adopt sqlite as the backend database for my applications. I'm now trying to find ways to access an sqlite database sitting in a remote machine through use of Netio remote procedure calls but I've hit a snug: HMG IDE returns 'undefined reference' error when it encounters netio_connect(..), netio_funcexec(..) and netio_disconnect(..). I would really appreciate any help on this.

Re: NETIO RPC

Posted: Sun Jul 11, 2010 12:44 pm
by Rathinagiri
Could you please provide a small sample project?

Re: NETIO RPC

Posted: Mon Jul 12, 2010 12:48 pm
by karweru
Dear Rathi,

Here is a very simplified version.

#include "hmg.ch"

Function Main
local cServer:='127.0.0.1',cPort:='2942'

DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 480 ;
TITLE 'Progress window' ;
MAIN

DEFINE MAIN MENU
POPUP "File"
ITEM "Connect" ACTION {||net_connect(cServer,cPort)}
ITEM "DisConnect" ACTION {||net_disconnect(cServer,cPort)}
ITEM "CreateDatabase" ACTION {||net_open("test.db",.t.)}
ITEM "Exit" ACTION form_1.release
END POPUP
END MENU

END WINDOW

CENTER WINDOW Form_1

ACTIVATE WINDOW Form_1

Return


*--------------------
FUNCTION net_connect(cServer,cPort,cPassword)
return netio_connect(cServer,cPort,cPassword)

*--------------------
FUNCTION net_disconnect(cServer,cPort)
return netio_disconnect(cServer,cPort)

*--------------------
FUNCTION net_open(cFile,lCreate)
if lCreate==Nil
lCreate:=.f.
endif
return net_exec("sqlite3_open",cFile,lCreate)

*--------------------
FUNCTION net_exec(cFunc,par1,par2,par3,par4,par5,par6,par7,par8,par9)
if pcount()>10
terminate("Too many parameters @net_exec()")
endif
return netio_funcExec(cFunc,par1,par2,par3,par4,par5,par6,par7,par8,par9)
All this is client side code.

Re: NETIO RPC

Posted: Mon Jul 12, 2010 1:17 pm
by Rathinagiri
Thanks Gilbert, I would check it out.

Re: NETIO RPC

Posted: Fri Aug 20, 2010 7:42 am
by karweru
I think the problem is the RPC functionality is not built into the libraries comprising hmg. Any way to remedy this?

Re: NETIO RPC

Posted: Fri Aug 20, 2010 12:54 pm
by gvaronas
karweru wrote:I think the problem is the RPC functionality is not built into the libraries comprising hmg. Any way to remedy this?

Hola Gilbert, tengo el mismo problema, yo uso una función para crear archivos temporales filetemp(), que fue implementada ultimamente. En NetIO tambien se han implementado varias cosas ultimamente, como por ejemplo RPC.
La solución sería construir una nueva distribución de HMG.3.0.35 con el ultimo SVN de harbour, intente hacerlo por mi cuenta, pero no tuve exito, reporte esto en este post:
viewtopic.php?f=2&t=1530&start=31

Esperemos que se publique una nueva distribución de HMG.3.0.35 con el ultimo SVN de Harbour.

Salu2,
GVS


Re: NETIO RPC

Posted: Fri Aug 20, 2010 4:22 pm
by apais
HMG is using Harbour last Stable distribution.
At that time RPC was not yet introduced to NETIO in Harbour.
You will have to recompile NETIO from harbour SVN in order to achieve what you want.

HTH
Angel

Re: NETIO RPC

Posted: Sun Aug 22, 2010 10:00 am
by gfilatov
Hi,

Please take a look for the following message by Viktor Szakáts at the Harbour developers forum:
Hi All,
I'm glad to announce that starting yesterday you can
download "nightly" Windows binary builds in the form
of unified installer and .7z file (similar to official binary
Windows releases) from sf.net files area:
http://sourceforge.net/projects/harbour ... ies-window...
These unified builds are made available around 02:00
CET every day, and they are like the official ones, though
with a more minimal approach: msvc, win64, wince, os/2,
ms-dos and linux binaries are not included. The reason for
this is to make the build process require less resources
(time, disk space and bandwidth). For most users this won't
be a problem and these can be enable if there is a need.
What _is_ included is mingw build using official mingw
distro (v4.5.0), bcc (v5.5.1) build and all contribs, including
QT ones. hbide and hbnetio tools are also part of the
official distro, and QT runtime is provided as well. Those
interested can also find the full build logs for download.
Pls note that the binaries may not be perfectly in sync
with the nightly sources, since they are generated on
different servers.
The build machine is kindly provided by Abe Buchinger.
Many thanks to him for this contribution.
Viktor
Hope that helps :idea:

Re: NETIO RPC

Posted: Sun Aug 22, 2010 11:06 am
by karweru
Thanks Grigory for the tip.
I have downloaded and copied all files from the habour build to \hmg\harbour folder and run \hmg\source\makeall.bat. However, trying to compile my program now brings the following error:
hbmk2: Compiling Harbour sources...
Harbour 2.1.0beta2 (Rev. 15383)
Copyright (c) 1999-2010, http://harbour-project.org/
hbmk2: Compiling...
hbmk2: Linking... classy.exe
C:/hmg/harbour/lib/win/mingw/libhbwin.a(legacycd.o):legacycd.c:(.text+0x0): multiple definition of `HB_FUN_GETLASTERROR'
C:/hmg//lib/libhmg.a(c_winapimisc.o):c_winapimisc.c:(.text+0xcbc): first defined here
I would really appreciate any ideas to resolve this.

Re: NETIO RPC

Posted: Mon Aug 23, 2010 7:45 am
by PeteWG
karweru wrote:Thanks Grigory for the tip.
I have downloaded and copied all files from the habour build to \hmg\harbour folder and run \hmg\source\makeall.bat. However, trying to compile my program now brings the following error:
hbmk2: Compiling Harbour sources...
Harbour 2.1.0beta2 (Rev. 15383)
Copyright (c) 1999-2010, http://harbour-project.org/
hbmk2: Compiling...
hbmk2: Linking... classy.exe
C:/hmg/harbour/lib/win/mingw/libhbwin.a(legacycd.o):legacycd.c:(.text+0x0): multiple definition of `HB_FUN_GETLASTERROR'
C:/hmg//lib/libhmg.a(c_winapimisc.o):c_winapimisc.c:(.text+0xcbc): first defined here
I would really appreciate any ideas to resolve this.

It's an rather typical problem of doubly defined winapi function(s).
Try to disable out the getlasterror() function instance which normally can be found inside hmg\source\c_winapimisc.c file.
To do this:
- locate c_winapimisc.c (it should lies into hmg\source\ as said above)
- open this file with your program editor of choice,
- move to line 416
- comment out lines 416-419 (/* */)
- save the file
- rebuild minigui lib. (makeall.bat)

If everything has gone ok, you must be able to build your appl.

---
Pete