473,657 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

loading modules in debug

The project I'm working on is written mainly C/C++, spiced with some
Python scripts. Now, I have several dlls, which work both as a Python
extension modules, exporting functions to Python via "initmodule ", and
as normal dynamic libraries, to which I link dynamically from within my
C program.

The problem is that, in debug mode, Python expects every module name to
be postfixed with _d, which makes my dynamic loading (using LoadLibrary)
not work, unless I #ifdef it everywhere, and append _d to the dlls
myself. I could do this, but I don't really like the idea. I'd be happy
to use the release python interpreter in debug mode too, but the python
header automatically pulls in the debug version.

Any ideas/suggestions what could I do?

thanks,
Andras
Jan 26 '06 #1
1 1370
[I haven't seen an answer for this older question, so I figured I'd go
ahead and post one]

Andras Balogh wrote:

The problem is that, in debug mode, Python expects every module name to
be postfixed with _d, which makes my dynamic loading (using LoadLibrary)
not work, unless I #ifdef it everywhere, and append _d to the dlls
myself. I could do this, but I don't really like the idea. I'd be happy
to use the release python interpreter in debug mode too, but the python
header automatically pulls in the debug version.

Any ideas/suggestions what could I do?


The easiest way to avoid this behavior on Windows is to replace the
code where you #include <Python.h> with something like this:

#ifdef _DEBUG
#undef _DEBUG
#include <Python.h>
#define _DEBUG
#else
#include <Python.h>
#endif

This should cause Python to stop looking for the _d named dlls.

-greg

Jan 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1294
by: fowlertrainer | last post by:
Hello ! I have used mod_python. But it is don't reload my modules when I editing them. I try with this: -------------------- # Module importer import os import traceback
1
1971
by: Kent Rollins | last post by:
I am writing a server and an MMC console app that use remoting to talk to each other. The MMC client and the server share a couple of assemblies: one has the interface that is remoted from the server and the other has some data structures that are passed across the remoted interface from the server to the client. These assemblies are not strong named and are not entered in the GAC. I could easily solve this problem by putting the DLL in...
4
11975
by: deko | last post by:
This is a basic program flow question. I'm trying to refractor an AC2000 app and split sections of code into separate modules. But there are a number of collections I create in one big module - containing file paths, Excel worksheet names, etc - I'm not sure how to pass these around, or if I'd be better off saving things to a table and using a recordset. My guess is a recordset would be slower. For example, should I do something like...
4
1452
by: MLH | last post by:
If I test the integrity of my code, opening a module, clicking Debug, Compile All Modules, the process stops at the first occurrence of a coding error. Can I skip that and go on somehow (you know, if the err occurs in a form module I'm testing but don't wanna fix right now)? How about a Debug, Compile All Modules Except For... ???
1
1371
by: Carl Bolstad | last post by:
I'm writing a C# class library, to be registered as COM and used as an extension to a commercial application called ArcMap. This approach has worked great for a long time, until... ....yesterday I noticed (in the output window) that the debugger was loading the release version of my projects output dll, rather than the debug version. After messing with the project settings (among other things) to try and remedy the situation, now my...
0
1810
by: Terry Tang | last post by:
Hi There, We are extending Python interpreter to support special functions of our tools. What we did is to compile Python's source code (which is got from the an installation on a Linux environment for Python 2.3.3) and our extensions (C++ code) on Windows with Microsoft Visual C++ 6.0 compiler to generate the extended Python interpreter. It works well on Linux and for the basic Python modules and our special modules on Windows. But...
7
15661
by: 2b|!2b==? | last post by:
I am attempting to manually load debug symbols for a module. I am doing it by carrying out the ff steps: i). Select the call stack window ii). right click and select 'Load Symbols' from displayed menu iii). The Find Symbols: MyModule.pdb dialog box is displayed However, when I navigate to and select the correct pdb file (myModule.pdb), an error message is displayed with the message:
4
1806
by: bhood2 | last post by:
I've come to the conclusion that posting about Embedded Python on the Python forums is a complete waste of time. I hope I can get some useful insights here. I'm looking for some help with extension modules built using Visual Studio. I'm using the simple extension module example "hello" (taken from the "Programming Python" book). I'm building it successfully in both release and debug mode using a Visual Studio project. I can...
3
1705
by: sandro | last post by:
Hi, I had two packages working fine toghether: debug and sqlkit. Debug provides a metaclass just for debuggging purposes to sqlkit (to log methods following a recipe on ASPN. It worked very well, just logging depending on the value of a module variable in debug module. That means module debug and it's variable where to be loaded before sqlkit.
0
8325
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.