10 messages in net.java.dev.jna.usersRe: [jna-users] Constants defined in ...
FromSent OnAttachments
Timo HoepfnerNov 20, 2008 5:50 am 
Timothy WallNov 20, 2008 6:22 am 
Timo HoepfnerNov 20, 2008 7:10 am 
Timothy WallNov 20, 2008 7:33 am 
LYou...@gkservices.comNov 20, 2008 7:53 am 
Timo HoepfnerNov 20, 2008 2:58 pm 
Scott PalmerNov 27, 2008 7:10 am 
Stefan EndrullisNov 27, 2008 7:38 am 
Scott PalmerNov 27, 2008 8:22 am 
Daniel KaufmannNov 27, 2008 10:05 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Constants defined in libraryActions...
From:LYou...@gkservices.com (LYou@gkservices.com)
Date:Nov 20, 2008 7:53:19 am
List:net.java.dev.jna.users

Timo,

I'm going to suggest what I always do in such situations which is not necessarily the correct approach but I believe it will get you past the current problem and you may choose to revisit it at some future point if you require more flexibility. I tend to fallback on defining what I need in C code if I feel it will be stable and not need a lot of rework as the application that is using it changes(since your library is stable I am assuming), something like get_ kCFCopyStringDictionaryKeyCallBacks(){return...}

Or maybe I'm not quite sure what you meant in your question, perhaps this would give you some ideas?

Levi Yourchuck Senior Programmer Analyst G&K Services Phone: 952 912 5828 www.gkservices.com Enhancing Image & Safety Through Innovation This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

Timo Hoepfner <th-@onlinehome.de> 11/20/2008 07:50 AM Please respond to use@jna.dev.java.net

To use@jna.dev.java.net cc

Subject [jna-users] Constants defined in library

Hi,

I'm trying to make some of Apple's C Libraries usable from java using JNA. So far it's going quite well, but there's one thing I can't find a solution for.

There are "constants" described in the header files, that I don't know how to get access to, as their value is defined in the library itself. E.g. I understand how I can define the following struct and callbacks with JNA, but I don't know how to get access to the value of "kCFTypeDictionaryKeyCallBacks" and "kCFCopyStringDictionaryKeyCallBacks":

typedef const void * (*CFDictionaryRetainCallBack)(CFAllocatorRef allocator, const void *value); typedef void (*CFDictionaryReleaseCallBack)(CFAllocatorRef allocator, const void *value); typedef CFStringRef (*CFDictionaryCopyDescriptionCallBack)(const void *value); typedef Boolean (*CFDictionaryEqualCallBack)(const void *value1, const void *value2); typedef CFHashCode (*CFDictionaryHashCallBack)(const void *value); typedef struct { CFIndex version; CFDictionaryRetainCallBack retain; CFDictionaryReleaseCallBack release; CFDictionaryCopyDescriptionCallBack copyDescription; CFDictionaryEqualCallBack equal; CFDictionaryHashCallBack hash; } CFDictionaryKeyCallBacks;

/*! @constant kCFTypeDictionaryKeyCallBacks Predefined CFDictionaryKeyCallBacks structure containing a set of callbacks appropriate for use when the keys of a CFDictionary are all CFTypes. */ CF_EXPORT const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks;

/*! @constant kCFCopyStringDictionaryKeyCallBacks Predefined CFDictionaryKeyCallBacks structure containing a set of callbacks appropriate for use when the keys of a CFDictionary are all CFStrings, which may be mutable and need to be copied in order to serve as constant keys for the values in the dictionary. */ CF_EXPORT const CFDictionaryKeyCallBacks kCFCopyStringDictionaryKeyCallBacks;

I'm not a big C expert, so please forgive me, if I miss something obvious...

Thanks for your help,

Timo