Function argument cannot have C name specification

閲覧: 22 回
最初の未読メッセージにスキップ

ptao

未読、
2010/08/04 19:42:032010/08/04
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

未読、
2010/08/05 3:46:152010/08/05
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

未読、
2010/08/05 6:59:412010/08/05
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

全員に返信
投稿者に返信
転送
新着メール 0 件