NETIO RPC

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

NETIO RPC

Post 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.
Kind regards,
Gilbert.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: NETIO RPC

Post by Rathinagiri »

Could you please provide a small sample project?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: NETIO RPC

Post 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.
Kind regards,
Gilbert.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: NETIO RPC

Post by Rathinagiri »

Thanks Gilbert, I would check it out.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: NETIO RPC

Post by karweru »

I think the problem is the RPC functionality is not built into the libraries comprising hmg. Any way to remedy this?
Kind regards,
Gilbert.
gvaronas
Posts: 109
Joined: Wed Aug 06, 2008 5:21 pm

Re: NETIO RPC

Post 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

User avatar
apais
Posts: 441
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF, Leto, MariaDB, SQLite
Location: uruguay
Contact:

Re: NETIO RPC

Post 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
Angel Pais
Web Apps consultant/architect/developer.
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: NETIO RPC

Post 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:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: NETIO RPC

Post 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.
Kind regards,
Gilbert.
PeteWG
Posts: 176
Joined: Sun Mar 21, 2010 5:45 pm

Re: NETIO RPC

Post 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
Post Reply