Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

calling a dll (Windows) from a processing unit

Hi there,

I have a set of windows XP machines with Gigaspaces. Now, I would like to call a function resided in a dll when a specific data object is written into the embedded space. The dll was originally used within Excel via VBA. Now I want to deploy the dll as a set of services in space. Any good advice on this? By the way, I heard about JNI but from my initial investigation, this is very difficult to use. Any better way to accomplish this? Will the .NET API from gigaspaces helpful?



{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2572]{quote}

asked 2008-09-06 01:52:04 -0600

superwai gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

Hi Jerry,

To create a field in a template to be a wholerdcard you need to assign it to null. There are two ways of achiving it. 1) Use nullable field (i.e. Nullable ) this way you’ll be able to assign the templates value to null and use it as a whild card. 2) Define a null value to the field. Null value definition allows you to define a value to a primitive that when used in a template will interprate to null for matching purposes. See also: http://www.gigaspaces.com/wiki/displa...

In the PU example the processed field is not nullable, as far as I see it the simplest way is to modify the example and make the field nullable.


answered 2008-09-15 01:09:18 -0600

guyt gravatar image
edit flag offensive delete link more

Is this a managed dll? (.NET)

If not, does the methods you wish to call have complex objects in their signature?

Basically what I am asking is if its is easy to use this dll from a .NET environment, if so it might be easier to use a .NET processing unit instead of creating a java processing unit that uses JNI. Assuming that you feed the objects to the space with code written in a Java, when using a .NET processing unit you need to consider that you'll need to create a corresponding .NET object for you pojos classes in the .NET processing unit because it's an interop scenario, you can read how to interop between Java and .NET in this page: http://www.gigaspaces.com/wiki/displa...

You can read about the .NET processing unit in: http://www.gigaspaces.com/wiki/displa... and to see a full example under: http://www.gigaspaces.com/wiki/displa...


Edited by: Eitan Yanovsky on Sep 6, 2008 5:23 AM

answered 2008-09-06 05:22:08 -0600

eitany gravatar image
edit flag offensive delete link more


Hi Eitan,

No, the dll is not a managed dll. Fortunately, there is no complex objects in the signature of the functions I wish to call. The signature is as simple as the following:

double getFoo(double i, double j, int, k);

In this case, which kind of processing unit (Java, C++, .NET) is best (in terms of ease of use)?



superwai gravatar imagesuperwai ( 2008-09-06 10:24:59 -0600 )edit

Calling such method is relatively easy from .NET with dllimport or from C++ environment, I guess it's up to how confident you feel with each language. Using C++ or .NET pu will require from you to create the corresponding language native interop object that represents the object that you are writing to the embedded space. Keep in mind that if your pu has sophisticated usage of open spaces polling containers and other components you won't have those out of the box when using C++ or .NET pu. However, if its a simple polling container you can base your code on the simple .NET Processing unit data example which has a built in polling container implementation.

If you're familiar with JNI it should not be too hard using it as well from a Java processing for that kind of methods.

It sums up to this, how easy you feel using each language, how much your pu relies on open spaces components and how complicated your object is in matter of interop, does it contain complex inner objects and stuff like that.

I hope this helps Eitan

eitany gravatar imageeitany ( 2008-09-06 12:30:31 -0600 )edit

To add to what Eitan just wrote: If you have an embedded space and you would like to preserve fast read operations (I assume you have a backup space so write operations will be affected with the sync replication speed that is a remote call) and you have your main business logic in Java you might want to stick to JNI call. JNI calls are not that expensive. Single Read operations in embedded mode with Java are faster than .Net or C++. This suggestion is based on the assumption that most of your activity deals with accessing the space and is Java based.



shay hassidim gravatar imageshay hassidim ( 2008-09-06 12:42:07 -0600 )edit

Hi Shay,

Thanks for your reply. Do you have sample codes for calling dll within the Openspaces framework?

In fact, the business logic is resided within the dll. But I want to use Openspaces just because it opens up many more possibilities than the other alternatives. I would think that, correct me if I'm wrong, it is easier to manage dll within C++ and .NET for simple applications. However, if I want to deploy the application in a larger scale then it might hinder further development?!? Please, correct me if I'm wrong.



superwai gravatar imagesuperwai ( 2008-09-07 21:15:07 -0600 )edit

Hi Eitan,

Thanks for your reply. Do you think that Gigaspaces will have better support for C++ and .NET in the future? I mean it will be nice if we can use Gigaspaces from C++ and .NET as simple as in the case of Openspaces. I will follow your advice today and try out the example in .NET to see how easy it is. I have no problem with any programming language, I'm looking for the right solution! :)



superwai gravatar imagesuperwai ( 2008-09-07 21:21:10 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2008-09-06 01:52:04 -0600

Seen: 123 times

Last updated: Sep 15 '08