Function argument cannot have C name specification

22 views
Skip to first unread message

ptao

unread,
Aug 4, 2010, 7:42:03 PM8/4/10
to cython-users
Hi,

I'm having trouble with the following function:

namespace TWSComManagerLib
{
class TWSComManager
{
public:
static std::string GetConfigParam(std::string sKey);
}
}


Here's my pxd:

cdef extern from "string" namespace "std":
cdef cppclass string:
char *c_str()
int length()

# Hack for static member functions
cdef extern from "libtwscom/TwsComManager.h" namespace
"TWSComManagerLib::TWSComManager":
string GetConfigParam(string sKey)

This gets the following error:

Error converting Pyrex file to C:
------------------------------------------------------------
...

# Hack for static member functions
cdef extern from "libtwscom/TwsComManager.h" namespace
"TWSComManagerLib::TWSComManager":
int TWSCount
TWSComManager *Instance()
string GetConfigParam(string sKey)
^
------------------------------------------------------------

.../libtwscom/cTwsCom.pxd:137:25: Function argument cannot have C name
specification

I have non-static functions which take string arguments which work
just fine. The only problem I'm having is with this function.

This is a serious blocker on a project I'm working on, so any help is
greatly appreciated.

Thanks.

Lionel Data

unread,
Aug 5, 2010, 3:46:15 AM8/5/10
to cython...@googlegroups.com


2010/8/5 ptao <phill...@gmail.com>
I don't think it has been fixed :(
I still have the same problem. I couldn't understand the code of Cython enough to fix it myself, so I had no other choice to wrap my namespace function with a simple function. Something like:

int    myFunc__myNamespace(int a, int b)
{
   return myNamespace::myFunc(a, b);
}

And wrap this with Cython.

Lionel

Robert Bradshaw

unread,
Aug 5, 2010, 6:59:41 AM8/5/10
to cython...@googlegroups.com
On Thu, Aug 5, 2010 at 12:46 AM, Lionel Data <lione...@gmail.com> wrote:
>
>
> I don't think it has been fixed :(

No. For the moment most efforts are focused on getting 0.13 out the
door (a.k.a. sorting out the issues with some heisenbug in Sage). The
new C++ support is really cool, but still quite unfinished.

> I still have the same problem. I couldn't understand the code of Cython
> enough to fix it myself, so I had no other choice to wrap my namespace
> function with a simple function. Something like:
>
> int    myFunc__myNamespace(int a, int b)
> {
>    return myNamespace::myFunc(a, b);
> }
>
> And wrap this with Cython.

That should work well.

- Robert

Reply all
Reply to author
Forward
0 new messages