Name conflict when python modules are transformed to C

24 views
Skip to first unread message

Joth

unread,
Jun 21, 2024, 6:50:17 AM (10 days ago) Jun 21
to cython-users
Hi,

I am trying to package a python project as a library to call it form C++.

In the case where I have 2 python modules with the same name but in different namespaces:
my_namespace_a.my_module
my_namespace_b.my_module
The 2 generated C files would define 2 functions with the same name: 
PyInit_my_module
It would result in a name conflict when linking C++ program.

How to deal with it ?

da-woods

unread,
Jun 21, 2024, 1:47:24 PM (9 days ago) Jun 21
to cython...@googlegroups.com
I think there's at least two tools that solve this problem in slightly different ways:


I'd suggest you either use one of these tools (I don't have a recommendation which one) or you at least follow their solution.

I'd also say: Cython isn't really designed to collapse multiple modules together like this, so maybe reconsider if what you're doing is a good idea.
--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cython-users/b8ebf309-7884-4bdd-91c9-efeb3447165dn%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages