non-GUI oaf
- From: Jonathan Bartlett <johnnyb wolfram com>
- To: orbit-list gnome org
- Subject: non-GUI oaf
- Date: Wed, 31 Oct 2001 12:38:28 -0600 (CST)
All-right, I'm trying to get OAF & shlibs to work from the command-line.
This is using the GNOME 1.x stuff. How does my program find oafd? I've
attached the files I'm trying to get running, in case you want to see what
I'm doing. I generate a skeleton from the .idl file, and just do a printf
for the method.
I tried just running oafd from the command line, and it didn't work. The
strace output looks like it didn't even get the request. Anyway, if
any of you have time, let me know.
Thanks,
Jon
PGP information is available at http://members.wri.com/johnnyb/about/
// Pass a string from client to server
interface Echo {
void echoString(in string input);
};
<oaf_info>
<oaf_server iid="OAFIID:Echo_factory:f4c3a11c-62ac-4033-a299-ce7110a6ddcc" type="shlib" location="/home/johnnyb/Projects/orbit/echo-shlib.so">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/GenericFactory:1.0" />
</oaf_attribute>
</oaf_server>
<oaf_server iid="OAFIID:Echo:ccadd12f-aec4-4e4a-b268-2550a243903f" type="factory" location="OAFIID:Echo_factory:f4c3a11c-62ac-4033-a299-ce7110a6ddcc">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Echo:1.0" />
</oaf_attribute>
</oaf_server>
</oaf_info>
#include <stdio.h>
#include <orb/orbit.h>
#include <liboaf/liboaf.h>
#include "echo.h"
int main(int argc, char *argv[])
{
CORBA_Environment ev;
CORBA_ORB orb;
Echo echo_client;
FILE *ifp;
char *ior;
char filebuffer[1024];
CORBA_exception_init(&ev);
orb = oaf_init(argc, argv);
echo_client = oaf_activate_from_id("OAFAID:OAFIID:Echo:ccadd12f-aec4-4e4a-b268-2550a243903f,johnnyb,localhost,echo", NULL, NULL, &ev);
if(!echo_client)
{
printf("ahhh!\n");
exit(1);
}
echo_client = CORBA_ORB_string_to_object(orb, ior, &ev);
printf("Type message to the server\nEnter '.' on a single line to quit\n");
while(fgets(filebuffer, 1024, stdin) )
{
if(filebuffer[0] == '.' && filebuffer[1] == '\n')
break;
//Discard newline
filebuffer[strlen(filebuffer) - 1] = '\0';
Echo_echoString(echo_client, filebuffer, &ev);
if(ev._major != CORBA_NO_EXCEPTION)
{
printf("we got exception %d from echoString!\n", ev._major);
return 1;
}
}
CORBA_Object_release(echo_client, &ev);
CORBA_Object_release((CORBA_Object)orb, &ev);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <orb/orbit.h>
#include <liboaf/liboaf.h>
#include "echo.h"
#include "echo-skelimpl.c"
static CORBA_Object echo_shlib_make_object(PortableServer_POA poa, const char *iid, gpointer impl_ptr, CORBA_Environment *ev)
{
CORBA_Object object_ref;
object_ref = impl_Echo__create(poa, ev);
oaf_plugin_use(poa, impl_ptr);
printf("Registering...\n");
return object_ref;
}
static const OAFPluginObject Echo_plugin_list[] =
{
{
"OAFIID:Echo:1.0",
echo_shlib_make_object
},
{
NULL
}
};
const OAFPlugin OAF_Plugin_info =
{
Echo_plugin_list,
"Echo Example"
};
gcc echo-common.c echo-server-shlib.c echo-skels.c -rdynamic `orbit-config --cflags --libs server client` `oaf-config --cflags --libs` -shared -fPIC -rdynamic -o echo-shlib.so
gcc echo-oaf-client.c echo-stubs.c echo-common.c -o echo `orbit-config --cflags --libs client` `oaf-config --cflags --libs`
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]