Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

A slick way to invoke a C++ component from a Java one?

7 posts in General Discussion (old) Last posting was on 2000-02-28 22:18:51.0Z
John Craig Posted on 2000-02-24 16:56:58.0Z
Newsgroups: sybase.public.easerver
Date: Thu, 24 Feb 2000 09:56:58 -0700
From: John Craig <jcraig@amlibs.com>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: A slick way to invoke a C++ component from a Java one?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 8
NNTP-Posting-Host: 205.163.222.177
Message-ID: <347_38B562DA.5C725682@amlibs.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27913
Article PK: 159611

Hi!

Anybody know a slick way to invoke a C++ component from a Java component
(both installed on one EA Server).

Is there any way to do this without setting up a CORBA connection
between the two components? I'm hoping to avoid that much overhead.

Thanks,

J Craig
epixtech.com


Dave Wolf [Sybase] Posted on 2000-02-24 22:04:44.0Z
Newsgroups: sybase.public.easerver
From: "Dave Wolf [Sybase]" <dwolf@sybase.com>
Subject: Re: A slick way to invoke a C++ component from a Java one?
Date: Thu, 24 Feb 2000 17:04:44 -0500
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 158.159.8.12
Message-ID: <347_LyGOvOxf$GA.201@forums.sybase.com>
References: <347_38B562DA.5C725682@amlibs.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27876
Article PK: 159580

Yes. Just generate java stubs for the C++ component and call them via the
stubs.

Dave Wolf
Internet Applications Division

"John Craig" <jcraig@amlibs.com> wrote in message
news:38B562DA.5C725682@amlibs.com...
> Hi!
>
> Anybody know a slick way to invoke a C++ component from a Java component
> (both installed on one EA Server).
>
> Is there any way to do this without setting up a CORBA connection
> between the two components? I'm hoping to avoid that much overhead.
>
> Thanks,
>
> J Craig
> epixtech.com
>


John Craig Posted on 2000-02-28 17:12:57.0Z
Newsgroups: sybase.public.easerver
Date: Mon, 28 Feb 2000 10:12:57 -0700
From: John Craig <jcraig@amlibs.com>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: "Dave Wolf [Sybase]" <dwolf@sybase.com>
Subject: Re: A slick way to invoke a C++ component from a Java one?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 48
NNTP-Posting-Host: 205.163.222.177
Message-ID: <347_38BAAC99.34F6607@amlibs.com>
References: <347_38B562DA.5C725682@amlibs.com> <347_LyGOvOxf$GA.201@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27655
Article PK: 159025

Dave,

When you say "call them via the stubs," I'm assuming you mean using an
ORB-type call rather than some other, more direct method I'm not aware of.
There isn't any way to call the C++ code that underlies the stubs without
creating an ORB instance as described in Evan Ireland's reply, right? [I've
pasted in Evan's response to my original question for reference.]

Thanks,

John

"Dave Wolf [Sybase]" wrote:

> Yes. Just generate java stubs for the C++ component and call them via the
> stubs.
>
> Dave Wolf
> Internet Applications Division
>
> "John Craig" <jcraig@amlibs.com> wrote in message
> news:38B562DA.5C725682@amlibs.com...
> > Hi!
> >
> > Anybody know a slick way to invoke a C++ component from a Java component
> > (both installed on one EA Server).
> >
> > Is there any way to do this without setting up a CORBA connection
> > between the two components? I'm hoping to avoid that much overhead.
> >
> > Thanks,
> >
> > J Craig
> > epixtech.com
> >

Evan wrote:

class MyJavaComp
{
private static ORB _orb;

static
{
String[] args = { "-org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB" };

_orb = ORB.init(args, null);
}

...

void myMethod()
{
MyCppComp cc =
MyCppCompHelper.narrow(_orb.string_to_object("MyPackage/MyCppComp"));
// use cc
}
}

This is as lightweight as you can make it. I hope it's 'slick' enough for you.

You avoid overhead of creating ORB objects by putting the ORB init call in the

static initializer for your component. Thus all instances of your component
share a single ORB object.
________________________________________________________________________________

Evan Ireland Sybase EA Server Engineering
eireland@sybase.com
Wellington - New Zealand +64 4
934-5856


Evan Ireland Posted on 2000-02-28 22:18:51.0Z
Newsgroups: sybase.public.easerver
Date: Tue, 29 Feb 2000 11:18:51 +1300
From: Evan Ireland <eireland@sybase.com>
Organization: Sybase, Inc.
X-Mailer: Mozilla 4.7 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: John Craig <jcraig@amlibs.com>
Subject: Re: A slick way to invoke a C++ component from a Java one?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 73
NNTP-Posting-Host: vpn-eme-029.sybase.com 130.214.8.29
Message-ID: <347_38BAF44B.49C1B643@sybase.com>
References: <347_38B562DA.5C725682@amlibs.com> <347_LyGOvOxf$GA.201@forums.sybase.com> <347_38BAAC99.34F6607@amlibs.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27625
Article PK: 159003


John Craig wrote:
>
> Dave,
>
> When you say "call them via the stubs," I'm assuming you mean using an
> ORB-type call rather than some other, more direct method I'm not aware of.
> There isn't any way to call the C++ code that underlies the stubs without
> creating an ORB instance as described in Evan Ireland's reply, right? [I've
> pasted in Evan's response to my original question for reference.]

There are three ways to call C++ code from a Java component within
the same process.

(1) Using JNI (native methods). This is fastest but is harder to code.

(2) Using C++ pseudo-components (only recently documented). This is
slower than JNI but faster than intercomponent calls.

(3) Using intercomponent calls. This does not use a "connection" as
we use in-memory IIOP for intercomponent calls within a process.

If the C++ code requires Jaguar transaction or security management around
the calls from Java, then only the last option is suitable.

> Thanks,
>
> John
>
> "Dave Wolf [Sybase]" wrote:
>
> > Yes. Just generate java stubs for the C++ component and call them via the
> > stubs.
> >
> > Dave Wolf
> > Internet Applications Division
> >
> > "John Craig" <jcraig@amlibs.com> wrote in message
> > news:38B562DA.5C725682@amlibs.com...
> > > Hi!
> > >
> > > Anybody know a slick way to invoke a C++ component from a Java component
> > > (both installed on one EA Server).
> > >
> > > Is there any way to do this without setting up a CORBA connection
> > > between the two components? I'm hoping to avoid that much overhead.
> > >
> > > Thanks,
> > >
> > > J Craig
> > > epixtech.com
> > >
>
> Evan wrote:
>
> class MyJavaComp
> {
> private static ORB _orb;
>
> static
> {
> String[] args = { "-org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB" };
>
> _orb = ORB.init(args, null);
> }
>
> ...
>
> void myMethod()
> {
> MyCppComp cc =
> MyCppCompHelper.narrow(_orb.string_to_object("MyPackage/MyCppComp"));
> // use cc
> }
> }
>
> This is as lightweight as you can make it. I hope it's 'slick' enough for you.
>
> You avoid overhead of creating ORB objects by putting the ORB init call in the
>
> static initializer for your component. Thus all instances of your component
> share a single ORB object.
> ________________________________________________________________________________
>
> Evan Ireland Sybase EA Server Engineering
> eireland@sybase.com
> Wellington - New Zealand +64 4
> 934-5856

--
________________________________________________________________________________

Evan Ireland Sybase EA Server Engineering eireland@sybase.com
Wellington - New Zealand +64 4 934-5856


Dave Wolf [Sybase] Posted on 2000-02-28 18:36:23.0Z
Newsgroups: sybase.public.easerver
From: "Dave Wolf [Sybase]" <dwolf@sybase.com>
Subject: Re: A slick way to invoke a C++ component from a Java one?
Date: Mon, 28 Feb 2000 13:36:23 -0500
Lines: 92
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: dwolf-nt.sybase.com 157.133.43.179
Message-ID: <347_ws7O$shg$GA.297@forums.sybase.com>
References: <347_38B562DA.5C725682@amlibs.com> <347_LyGOvOxf$GA.201@forums.sybase.com> <347_38BAAC99.34F6607@amlibs.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27639
Article PK: 159009

Do the same thing in C++. Statically initialize the ORB an do
orb->string_to_object()

Dave Wolf
Internet Applications Division

"John Craig" <jcraig@amlibs.com> wrote in message
news:38BAAC99.34F6607@amlibs.com...
> Dave,
>
> When you say "call them via the stubs," I'm assuming you mean using an
> ORB-type call rather than some other, more direct method I'm not aware of.
> There isn't any way to call the C++ code that underlies the stubs without
> creating an ORB instance as described in Evan Ireland's reply, right?
[I've
> pasted in Evan's response to my original question for reference.]
>
> Thanks,
>
> John
>
>
> "Dave Wolf [Sybase]" wrote:
>
> > Yes. Just generate java stubs for the C++ component and call them via
the
> > stubs.
> >
> > Dave Wolf
> > Internet Applications Division
> >
> > "John Craig" <jcraig@amlibs.com> wrote in message
> > news:38B562DA.5C725682@amlibs.com...
> > > Hi!
> > >
> > > Anybody know a slick way to invoke a C++ component from a Java
component
> > > (both installed on one EA Server).
> > >
> > > Is there any way to do this without setting up a CORBA connection
> > > between the two components? I'm hoping to avoid that much overhead.
> > >
> > > Thanks,
> > >
> > > J Craig
> > > epixtech.com
> > >
>
> Evan wrote:
>
> class MyJavaComp
> {
> private static ORB _orb;
>
> static
> {
> String[] args = { "-org.omg.CORBA.ORBClass",
"com.sybase.CORBA.ORB" };
>
> _orb = ORB.init(args, null);
> }
>
> ...
>
> void myMethod()
> {
> MyCppComp cc =
> MyCppCompHelper.narrow(_orb.string_to_object("MyPackage/MyCppComp"));
> // use cc
> }
> }
>
> This is as lightweight as you can make it. I hope it's 'slick' enough for
you.
>
> You avoid overhead of creating ORB objects by putting the ORB init call in
the
>
> static initializer for your component. Thus all instances of your
component
> share a single ORB object.
>

____________________________________________________________________________
____
>
> Evan Ireland Sybase EA Server Engineering
> eireland@sybase.com
> Wellington - New Zealand +64 4
> 934-5856
>


Remus Eserblom Posted on 2000-02-28 18:12:38.0Z
Newsgroups: sybase.public.easerver
From: "Remus Eserblom" <remus_eserblom@hotmail.com>
Subject: Re: A slick way to invoke a C++ component from a Java one?
Date: Mon, 28 Feb 2000 19:12:38 +0100
Lines: 91
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: ppcremus.sybase.com 158.76.135.81
Message-ID: <347_pR367dhg$GA.202@forums.sybase.com>
References: <347_38B562DA.5C725682@amlibs.com> <347_LyGOvOxf$GA.201@forums.sybase.com> <347_38BAAC99.34F6607@amlibs.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27646
Article PK: 159014

Do you want to use MASP? Then you can call the component like executing a
store procedure in the database.

/Remus

"John Craig" <jcraig@amlibs.com> wrote in message
news:38BAAC99.34F6607@amlibs.com...
> Dave,
>
> When you say "call them via the stubs," I'm assuming you mean using an
> ORB-type call rather than some other, more direct method I'm not aware of.
> There isn't any way to call the C++ code that underlies the stubs without
> creating an ORB instance as described in Evan Ireland's reply, right?
[I've
> pasted in Evan's response to my original question for reference.]
>
> Thanks,
>
> John
>
>
> "Dave Wolf [Sybase]" wrote:
>
> > Yes. Just generate java stubs for the C++ component and call them via
the
> > stubs.
> >
> > Dave Wolf
> > Internet Applications Division
> >
> > "John Craig" <jcraig@amlibs.com> wrote in message
> > news:38B562DA.5C725682@amlibs.com...
> > > Hi!
> > >
> > > Anybody know a slick way to invoke a C++ component from a Java
component
> > > (both installed on one EA Server).
> > >
> > > Is there any way to do this without setting up a CORBA connection
> > > between the two components? I'm hoping to avoid that much overhead.
> > >
> > > Thanks,
> > >
> > > J Craig
> > > epixtech.com
> > >
>
> Evan wrote:
>
> class MyJavaComp
> {
> private static ORB _orb;
>
> static
> {
> String[] args = { "-org.omg.CORBA.ORBClass",
"com.sybase.CORBA.ORB" };
>
> _orb = ORB.init(args, null);
> }
>
> ...
>
> void myMethod()
> {
> MyCppComp cc =
> MyCppCompHelper.narrow(_orb.string_to_object("MyPackage/MyCppComp"));
> // use cc
> }
> }
>
> This is as lightweight as you can make it. I hope it's 'slick' enough for
you.
>
> You avoid overhead of creating ORB objects by putting the ORB init call in
the
>
> static initializer for your component. Thus all instances of your
component
> share a single ORB object.
>

____________________________________________________________________________
____
>
> Evan Ireland Sybase EA Server Engineering
> eireland@sybase.com
> Wellington - New Zealand +64 4
> 934-5856
>


Evan Ireland Posted on 2000-02-24 20:35:48.0Z
Newsgroups: sybase.public.easerver
Date: Fri, 25 Feb 2000 09:35:48 +1300
From: Evan Ireland <eireland@sybase.com>
Organization: Sybase, Inc.
X-Mailer: Mozilla 4.7 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: John Craig <jcraig@amlibs.com>
Subject: Re: A slick way to invoke a C++ component from a Java one?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 30
NNTP-Posting-Host: vpn-eme-022.sybase.com 130.214.8.22
Message-ID: <347_38B59624.67425229@sybase.com>
References: <347_38B562DA.5C725682@amlibs.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:27893
Article PK: 159593


John Craig wrote:
>
> Hi!
>
> Anybody know a slick way to invoke a C++ component from a Java component
> (both installed on one EA Server).
>
> Is there any way to do this without setting up a CORBA connection
> between the two components? I'm hoping to avoid that much overhead.

class MyJavaComp
{
private static ORB _orb;

static
{
String[] args = { "-org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB" };
_orb = ORB.init(args, null);
}

...

void myMethod()
{
MyCppComp cc = MyCppCompHelper.narrow(_orb.string_to_object("MyPackage/MyCppComp"));
// use cc
}
}

This is as lightweight as you can make it. I hope it's 'slick' enough for you.

You avoid overhead of creating ORB objects by putting the ORB init call in the
static initializer for your component. Thus all instances of your component
share a single ORB object.
________________________________________________________________________________

Evan Ireland Sybase EA Server Engineering eireland@sybase.com
Wellington - New Zealand +64 4 934-5856