On Oct 2, 2010, at 3:10 AM, Kurt Sutter <k...@quansoft.com> wrote:

> Sorry to be obtuse, but it may be that I am overlooking something. Presently, 
> we have calls such as
> 
> n = PyNumber_Float(obj)
> s = PyString_AsString(obj)
> 
> I understand that I would need to generate #defines for all those names, such 
> as PyNumber_Float to map them to some table. I would have to initialize that 
> table in a big for loop that goes through another table containing the name 
> of each function (e.g. "PyNumber_Float". The loop then looks each name up 
> with dlsym and initializes the table.
> 
> Or can this be done more elegantly?

Maybe weak linking can help here. If you weak link the Python library and call 
dlopen early on in your program's lifetime with the appropriate path, I think 
dyld will populate all the weak linked functions it finds.
--Kyle Sluder_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to