|
|
Mixing library written in different languages
|
|
|
|
Fresh-Faced Recruit
Join Date: Mar 2003
Status:
Offline
|
|
I have a really quick question.
I am writing a simple software that will resize hundreds of pictures in a batch process and then ftp them to a server with couple of setting files.
I have the ftp library that is written in Java and I was planning on using DevIL image library that is written in C++.
How would I go about using both of these libraries from a single application.
I was planning on using Cocoa/Java but I dont really know how to mix and match the different languauges using XCode, as this is my first application in Mac OSX (I am recent switcher)
Thanks
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status:
Offline
|
|
These are kind of general answers, but for info about accessing Java from Objective-C check out this article about the Java Bridge.
I know you can pretty easily use C++ libraries from Cocoa via Objective-C++, see some info about that here. One important thing to keep in mind, name files that use Objective-C++ with a .mm extension in xcode! There might be some newer documentation regarding Objective-C++ but I've just started writing an app that uses a C++ library and haven't had any issues.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Boulder, CO, USA
Status:
Offline
|
|
Originally posted by ThaShef:
I am writing a simple software that will resize hundreds of pictures in a batch process and then ftp them to a server with couple of setting files.
I have the ftp library that is written in Java and I was planning on using DevIL image library that is written in C++.
How would I go about using both of these libraries from a single application.
It's probably possible, but unless someone has already come up with a way to do it (eg, hooks in Java that let you run foreign code), I'm guessing it'll be more work than it's worth. You may consider making two apps and bridging them with applescript or your own interapplication messaging system.
I'm pessimistic because Java and C++ code run in completely different runtime environments and use completely different executable formats. Getting both to live happily in a single app might be tricky. But ymmv!
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Mar 2003
Status:
Offline
|
|
Originally posted by itai195:
These are kind of general answers, but for info about accessing Java from Objective-C check out this article about the Java Bridge.
I know you can pretty easily use C++ libraries from Cocoa via Objective-C++, see some info about that here. One important thing to keep in mind, name files that use Objective-C++ with a .mm extension in xcode! There might be some newer documentation regarding Objective-C++ but I've just started writing an app that uses a C++ library and haven't had any issues.
Do I have to program in Objective-C or Objective-C++, could I just use straight C++.
Thanks
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
Do I have to program in Objective-C or Objective-C++, could I just use straight C++.
You may have both C++ files (.cpp) and "Objective-C++" files (.mm) in your project.
"Programming in Objective-C++" just means creating a source code file with a .mm extension, filling it with Objective-C code, and then occasionally making use of some C++ classes.
I think the way it goes is, if you like using C++, most of your files will be C++ (and will be making use of C++ libs like DevIL) except for one or two with Obj-C and C++ mixed: the .mm file(s) -- that's where you glue your C++ code into your Objective-C GUI stuff.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|