tags:

views:

739

answers:

6

I have an application in C# that currently authenticates to LDAP. We want to extend functionality to support IBM's Tivoli Access Manager, which is comprised of a Policy Server, and an LDAP server (and other modules as well). Unfortunately authenticating with the LDAP server for our customer is not acceptable, thus we must bind with the policy server instead.

The TAM's Policy Server has 2 APIs for authentication, one in Java, and one in C

My question: What is the better language for C# to interop, C or Java?

Keeping in mind: maintainability, and cost of development.

Thanks everyone in Advance.

+1  A: 

I've had good success with Managed C++/CLI for interfacing with C/C++ in the past, can't speak much on interfacing with java.

Also if you are going for straight C you can export the function calls directly to C#.

vvanders
+2  A: 

Seems to me that C is the easier language for C# to inter-operate with, as there's a native interface in .NET to allow "unsafe" access. To communicate with Java, you have to go though JNI to get into Java, or use J#, or otherwise jump through hoops to communicate from C# to Java and back again.

I've not done any C# to Java communication (except across a socket or across Web Services), but I was on a team that used JNI to communicate from Java to COM via C++ code. We ended up having to throw away the JNI solution as too unwieldy. We rewrote the C++ component in C# and used a nailed-up socket for communication between the two components. This worked fabulously.

From this experience, if you are already using C#, then I would use the C API from C#. This is easy to do.

Eddie
A: 

I would think that the API you are interfacing is nothing but an API. One front-end is Java, and the other is C, but you probably aren't interacting with Java code, probably just C.

That said, I suppose it would be whichever interface seems simpler. I'm guessing that C is, but if there is some great Java binding software that lets C# access Java libraries easily, it might be better.

Chances are they both link to C code right beneath the API.

Bill K
A: 

I like Eddie's answer, but I would temper it with this observation - it depends on the skill set you ave in house. If you;'ve got a bunch of Java pros, then it makes sense to use Java. If you have a bunch of C-programmers, then the chouice is obvious.

One other comment though : are you sure TAM doesn't do .NET?

Cheeso
A: 

I am author of jni4net, open source intraprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke.

Pavel Savara
A: 

You shouldn't need to do any bridge between C# and C or Java. As Cheeso referenced, TAM has had a supported .NET API for a while now -- see here for information.

craigforster