Accessing GCJ binaries from Visual Basic?
Andrzej Bialecki
ab@getopt.org
Thu Aug 11 20:46:00 GMT 2005
Mohan Embar wrote:
> Hi Andrew,
>
>
>>>You can write a DLL wrapper around the gcj code and then call this
>>>DLL from VB.
>>
>>I see. How would you communicate with it?
>
>
> So:
>
> - you write your Java/gcj code
> - you create a C wrapper API around it which invokes
> the Java code via CNI or JNI
> - you build a shared library (DLL) which exports this
> wrapper API
>
> Visual Basic has language constructs which
> allow for declaring stub functions which reference
> the corresponding ones in the DLL. You then call
> these functions from within VB code as you
> would any other VB function.
Thanks a lot to all who responded. I can imagine working with CNI in
C++, because it's more or less clear to me how to work with class
instances in results and arguments, but I'm far less sure how to wrap
this to be able to use them from VB and handle complex result types or
complex arguments to method calls. Let's say I have a class:
public class Test {
String a;
Test link;
public Test getLink() { return link; }
public void setLink(Test link) {this.link = link;}
}
The header file Test.h is this:
class Test : public ::java::lang::Object
{
public:
virtual ::Test *getLink () { return link; }
virtual void setLink (::Test *);
Test ();
public: // actually package-private
::java::lang::String * __attribute__((aligned(__alignof__(
::java::lang::Object )))) a;
::Test *link;
public:
static ::java::lang::Class class$;
};
Now, my question is how should I wrap in VB the return result of
getLink(), or handle the argument to setLink method to be able to use
them transparently in VB, without re-packaging all results and arguments
into VB primitive types?
--
Best regards,
Andrzej Bialecki <><
___. ___ ___ ___ _ _ __________________________________
[__ || __|__/|__||\/| Information Retrieval, Semantic Web
___|||__|| \| || | Embedded Unix, System Integration
http://www.sigram.com Contact: info at sigram dot com
More information about the Java
mailing list