Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7875749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:02:52+00:00 2026-06-03T03:02:52+00:00

I want to use Cython to convert multiple .pyx files into an executable package

  • 0

I want to use Cython to convert multiple .pyx files into an executable package (.DLL).

How do I create a single Windows DLL from multiple .pyx via distutils?

Sample used:

sub1.pyx:

cimport sub1

class A():
    def test(self, val):
        print "A", val

sub1.pxd:

cdef class A:
    cpdef test(self,val)

sub2.pyx:

cimport sub2

class B():
    def test(self):
        return 5

sub2.pxd:

cdef class B:
    cpdef test(self)

init.py:

cimport sub1
cimport sub2

import sub1
import sub2

setup.py:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [Extension("sub", ["__init__.pyx", "sub1.pyx", "sub2.pyx"])]

setup(
  name = 'Hello world app',
  cmdclass = {'build_ext': build_ext},
  ext_modules = ext_modules
)

Error:

sub1.obj : error LNK2005: ___pyx_module_is_main_sub already defined in __init__.obj
sub1.obj : error LNK2005: _initsub already defined in __init__.obj
sub2.obj : error LNK2005: ___pyx_module_is_main_sub already defined in __init__.obj
sub2.obj : error LNK2005: _initsub already defined in __init__.obj
Creating library build\temp.win32-2.7\Release\sub.lib and object build\temp.win32-2.7\Release\sub.exp
C:\temp\ctest\sub\sub.pyd : fatal error LNK1169: one or more multiply defined symbols found
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:02:53+00:00Added an answer on June 3, 2026 at 3:02 am

    I was not aware of this :

    http://groups.google.com/group/cython-users/browse_thread/thread/cbacb7e848aeec31

    I report the answer of one of the main coders (Lisandro Dalcin) of cython (sorry for cross posting):

    ext_modules=[ 
        Extension("myModule", 
                  sources=['src/MyFile1.pyx', 
                           'src/MyFile2.pyx'], 
    

    You cannot have a single “myModule” built from two different sources.
    Perhaps you could add a “src/myModule.pyx” file, with the two lines
    below:

    # file: myModule.pyx 
    include "MyFile1.pyx" 
    include "MyFile2.pyx" 
    

    and then use

    Extension("myModule", sources=['src/myModule.pyx'], ...) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use from multiple upload image in codeigniter but problem is here that
i want use some data from a website with web service. i have a
Where are the Gnulib files in Linux? I want use lib like safe-read, mbchar,
I want use localized strings from resources in xsl template as in aspx page,
I want use three div to create a round effect,like <div class=wrapper> <div class=left-corner></div>
i want use select statement on the a table and inserting result into a
I want use php curl with oauth to get the JSON data from twitter
I want use $.ajax to read some infomation from xml file,here is my js
I want use $.ajax get a url string from a xml file ,then with
i want use single quotations inside a transact sql statement, then execute that statement.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.