Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
I am using Obj C with Cocoa framework.
I have a Mono (C# on linux) class with a function
Code:
void CheckForUpdate(string ID,out int version);
I made changes to call other mono functions from Obj C successfully.
But the above said mono function is expecting a reference while calling it.
How can I call it from my ObjC code?
 
if this is for real-life use, and not an academic exercise, I would recommend writing a C# function like this:
Code:
int wrapCheckForUpdate(string ID, int version) {
  CheckForUpdate(ID,out version);
  return version;
}

Then in your C/Objective-C code, using the embedded mono libraries (which it sounds like you already know how to do), call wrapCheckForUpdate passing ID and version by value, and grab its result.

If the value of version that you pass in is unimportant, and its value after the call is all that matters, you can just do something like:
Code:
int wrapCheckForUpdate(string ID) {
  int version;
  CheckForUpdate(ID, out version);
  return version;
}

It seems strange not to just return the version and set a reference parameter if the value passed in is not needed, but *shrug* it makes your wrapper and invocation simpler if that's the case.

If you DO want to do this "purely"... well, I don't have time to review the Embedded Mono docs. There's probably a way, but I haven't needed it to this point.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.