You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old How to load a Symbian DLL - 2005-09-16, 13:08

Join Date: Jun 2005
Posts: 42
ggomeze
Offline
Registered User
I am newbie in Python, and though i´ve been reading all documentation i´ve been able to, i haven´t found any issue concerning with dinamically Symbian C++ libraries loading.

I am not sure if i must use init functions and Py_InitModule () as C.

Have anyone done a functional extension of Python with these kind of libraries?.

Any help will be appreciated.

Thanks in advance
Reply With Quote

#2 Old Re: How to load a Symbian DLL - 2005-09-17, 01:24

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
I don't quite understand what you mean by loading Symbian C++ libraries dynamically. Can you be more specific?
Reply With Quote

#3 Old Re: How to load a Symbian DLL - 2005-09-19, 08:48

Join Date: Jun 2005
Posts: 42
ggomeze
Offline
Registered User
Just imagine i extend Python using a Symbian DLL, for instance, a polymorphic DLL.How can i load this library?, must my Symbian DLL implement a specific interface?. Hope this clarify my question. Thanks!
Reply With Quote

#4 Old Re: How to load a Symbian DLL - 2005-09-19, 09:36

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
Check out the 1.1.6 release. A minimal example extension is included.
Reply With Quote

#5 Old Re: How to load a Symbian DLL - 2005-09-19, 09:56

Join Date: Jun 2005
Posts: 42
ggomeze
Offline
Registered User
Do you mean 1.6.1 (September 2000)???.

Oldest python version available is 1.5.2, isn´t it??

Thanks for your response!
Reply With Quote

#6 Old Re: How to load a Symbian DLL - 2005-09-19, 09:59

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
No, I'm referring to Python for Series 60 release 1.1.6 which came out this summer. It's built on Python interpreter version 2.2.2.
Reply With Quote

#7 Old Re: How to load a Symbian DLL - 2005-09-19, 10:13

Join Date: Jan 2005
Posts: 148
Location: Bangkok, Thailand
Send a message via MSN to korakotc
korakotc's Avatar
korakotc
Offline
Regular Contributor
Jplauril, would it be possible to have something like ctypes on symbian as well?
Ctypes make calling native dll much easier, no need to create an extension for interface.
Reply With Quote

#8 Old Re: How to load a Symbian DLL - 2005-09-19, 10:30

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
Unfortunately using ctypes would be quite problematic. All interesting Symbian API's are C++ and ctypes is built with C in mind. To create C++ objects to pass as parameters you would need to parse the headers with a real C++ compiler and this would be much more complicated than for C. An additional inconvenience is that Symbian DLL's don't include function names, just ordinals, so you would have to pregenerate the naming information for the SDK libraries beforehand.
Reply With Quote

#9 Old Re: How to load a Symbian DLL - 2005-09-19, 10:41

Join Date: Sep 2003
Posts: 209
Location: Finland
otsov
Offline
Regular Contributor
Quote:
Originally Posted by ggomeze
Just imagine i extend Python using a Symbian DLL, for instance, a polymorphic DLL.How can i load this library?, must my Symbian DLL implement a specific interface?. Hope this clarify my question. Thanks!
Have a look at "RLibrary" in your SDK documentation if you are dynamically loading DLLs.
Reply With Quote

#10 Old Re: How to load a Symbian DLL - 2005-09-19, 10:49

Join Date: Jun 2005
Posts: 42
ggomeze
Offline
Registered User
I know how to load a Symbian DLL from Symbian. My doubt was related to load those libraries from Python. I have many modules (Symbian DLL Libraries) made on Symbian and i would like to reuse them from Python.

Thanks anyway for your response
Reply With Quote

#11 Old Re: How to load a Symbian DLL - 2005-09-20, 12:26

Join Date: Aug 2004
Posts: 290
simo.salminen
Offline
Regular Contributor
Quote:
Originally Posted by ggomeze
I know how to load a Symbian DLL from Symbian. My doubt was related to load those libraries from Python. I have many modules (Symbian DLL Libraries) made on Symbian and i would like to reuse them from Python.

Thanks anyway for your response
As said, there is no direct way to load C++ libraries from Python. You must implement a C++ wrapper. The wrapper calls your C++ library.

So, the call sequence will be following:
Python->Python C++ wrapper->Your C++ Library.

For instructions how to implement the wrapper, please see API doc, appendix C.
Reply With Quote

#12 Old Re: How to load a Symbian DLL - 2005-09-20, 12:50

Join Date: Jun 2005
Posts: 42
ggomeze
Offline
Registered User
Ok thank you!, that´s what i needed!.

Let me have a look and find out if it resolves my doubts, but it sounds very well.
Reply With Quote

#13 Old Re: How to load a Symbian DLL - 2005-09-21, 09:57

Join Date: Aug 2004
Posts: 290
simo.salminen
Offline
Regular Contributor
This previous post that shows exactly how to implement a wrapper: http://discussion.forum.nokia.com/fo...ad.php?t=65720
Reply With Quote

#14 Old Re: How to load a Symbian DLL - 2007-09-08, 21:29

Join Date: Nov 2004
Posts: 14
terohiit
Offline
Registered User
Quote:
Originally Posted by jplauril View Post
Unfortunately using ctypes would be quite problematic. All interesting Symbian API's are C++ and ctypes is built with C in mind.
Now that Open C is available I think it'd make some sense to have ctypes for PyS60. Presumably there will also be other C libraries built on top of Open C. I've started looking into porting ctypes (and libffi). Here is what I have so far: http://www.hiit.fi/files/fi/da/ctypes/web/
Reply With Quote

#15 Old Re: How to load a Symbian DLL - 2007-09-10, 20:49

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by terohiit View Post
Now that Open C is available I think it'd make some sense to have ctypes for PyS60. Presumably there will also be other C libraries built on top of Open C. I've started looking into porting ctypes (and libffi). Here is what I have so far: http://www.hiit.fi/files/fi/da/ctypes/web/
Hello Tero

It's very great

I packed the missing ctypes (pure python) and put it on my site.
Now I can use the testing code
Code:
import ctypes
import _ctypes

h = _ctypes.dlopen("libcrypto.dll")
try:
    print type(h)
    sha = _ctypes.dlsym(h, "1491")
    init = _ctypes.dlsym(h, "1493")
    update = _ctypes.dlsym(h, "1495")
    final = _ctypes.dlsym(h, "1492")
    print [sha, init, update, final]

    data = "digestible message"
    result = ctypes.create_string_buffer(20)
    _ctypes.call_function(sha, (data, len(data), result))
    print ctypes.sizeof(result), repr(result.raw)
finally:
    _ctypes.dlclose(h)

"""
To do the same with the Python "sha" library:

import sha
result = sha.new("digestible message").digest()
print len(result), repr(result)

"""
Look at my site and download the missing ctypes python part !

links :
ctypes 1.0.2 3rd (without _ctypes.pyd !)

Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Current Symbian Development Opportunities...!! mobile2004 General Symbian C++ 0 2005-01-17 18:58
GCC TOOLS to inspect Symbian DLL and LIB files? jjclose Symbian Tools & SDKs 1 2004-11-18 17:54
Global Symbian Development Opportunities *High Importance* sara.lindsay General Symbian C++ 0 2004-05-21 12:16
Global Symbian Development Opportunities *High Importance* sara.lindsay General Symbian C++ 2 2004-05-08 10:09
Global Symbian Development Opportunities *High Importance* sara.lindsay General Symbian C++ 0 2004-05-07 12:45

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia