[Pythonmac-SIG] custom framework with bridgesupport file

Ronald Oussoren ronaldoussoren at mac.com
Tue Apr 19 13:27:47 CEST 2011


On 19 Apr, 2011, at 11:40, Georg Seifert wrote:

> Hi,
> 
> I have an app written in cocoa and run python scripts from within the app using "PyRun_SimpleString" (I asked about that a couple of times and got great help).
> 
> My problem now is that I want to use some c functions from within a custom framework that is embedded in my app. The only way I could get it to work is to load the bridgesupport file manually:
> 
> _path = objc.pathForFramework('../Frameworks/MyFramework.framework')
> f = open(_path+'/Versions/A/Resources/BridgeSupport/MyFramework.bridgesupport')
> objc.parseBridgeSupport(f.read(), globals(), _path+'/Versions/A/Resources/BridgeSupport/MyFramework.bridgesupport')
> f.close()
> 
> I have to put this in the script for every run. Is there a better way to tell python to pick the file up automatically?

You will always have to do something to load the bridgesupport data.  You might be able to use "objc.initFrameworkWrapper", that function will load the embedded bridgesupport file. This function is usually used to also load the framework, but when you specify the framework identifier it wouldn't do that when the framework is already loaded.

Ronald


Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2224 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20110419/77a91b77/attachment.bin>


More information about the Pythonmac-SIG mailing list