473,727 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to load the DLL with PyRun_SimpleStr ing?

Hi,

Have anyone know how to import the DLL in C program?
Actually, I have used the statement 'PyRun_SimpleSt ring' to import .PY,

Such as,
r = PyRun_SimpleStr ing("import os");
It's be fine.
If importing the DLL by this commdand,

Such as,
r = PyRun_SimpleStr ing("import example");

return the error code -1.
Should any advice, let me know whatever you try...

Thanks in advance.
Link
Jul 18 '05 #1
3 4531
"Link" <li******@hotma il.com> writes:
Hi,

Have anyone know how to import the DLL in C program?
Actually, I have used the statement 'PyRun_SimpleSt ring' to import
.PY,
Such as,
r = PyRun_SimpleStr ing("import os");
It's be fine.
If importing the DLL by this commdand,

Such as,
r = PyRun_SimpleStr ing("import example");

return the error code -1.


Is the .dll named .pyd? Is the .pyd on your sys.path?
--

Vennlig hilsen

Syver Enstad
Jul 18 '05 #2
Exactelly, the named example is .DLL and put it on the sys.path.

That I had check it carefully.
But the result make me sad what I failed to load.

Could you give me more advice? Such as the other statement for loading DLL
as same as the 'PyRun_SimpleSt ring' command.

Regards,
Link

"Syver Enstad" <sy************ *@online.no>
???????:u1***** ******@online.n o...
"Link" <li******@hotma il.com> writes:
Hi,

Have anyone know how to import the DLL in C program?
Actually, I have used the statement 'PyRun_SimpleSt ring' to import
.PY,
Such as,
r = PyRun_SimpleStr ing("import os");
It's be fine.
If importing the DLL by this commdand,

Such as,
r = PyRun_SimpleStr ing("import example");

return the error code -1.


Is the .dll named .pyd? Is the .pyd on your sys.path?
--

Vennlig hilsen

Syver Enstad

Jul 18 '05 #3
"Link" <li******@hotma il.com> writes:
Exactelly, the named example is .DLL and put it on the sys.path.


Rename the .dll to .pyd.

--

Vennlig hilsen

Syver Enstad
Jul 18 '05 #4

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

Similar topics

0
2801
by: Link | last post by:
Dear, How is the wonderful PYTHON for me. It attracts me with its additional variety. I am developing in C program as well as first to use C++ with extending & embedding PYTHON. It seems not to easy. What do I mean? See that following steps what I am doing.
3
1642
by: Bill Orcutt | last post by:
Having seen the number of lost souls asking questions about embedding Python in the archives of this group, I hesitate to add myself to their number, but I've hit a problem I can't quite get my head around. I have a simple C program that embeds a python interpreter to execute python commands and return stdout, and to a point everything works as intended. The problem that each command seems to be executed in its own context and knows...
6
4318
by: JS | last post by:
EE instance DB2 v7.2.0 fixpack 3 on WIN2K. I select some data from a table A and write it to a file using the COALESCE function and whitespace as the null character: eg coalesce(col1, ' '). This column has 10,000 nulls in table A. Select count(*) from table A where col1 is null=10,000 Using the load utlity, I load the data file as follows into table B which has not null constraint on col1: LOAD FROM LOAD.TEST OF ASC MODIFIED BY...
2
2022
by: **Developer** | last post by:
I have a Form (FV&C) containing a userconrtrol (CF&E) I do a ShowDialog for the form and the form's Load calls a method of the UserControl. The first time I do this the usercontrol appears on the form as I'd expect after the method had been run. The second time I do this the usercontrol appears on the form as if the usercontrols Load had last been run.
3
7195
by: db2udbgirl | last post by:
Env: DB2 UDB 8.2, AIX 5.3 While trying to load data (73 Million rows, Medium size table uses 4K tablespace) into a table using cursor it fails with "SQL0964C The transaction log for the database is full. SQLSTATE=57011" But I felt that Load utility wont log any acvitities on the database. Here it what I tried to do db2 "declare c1 cursor for select CAST(PARTITIONING_NBR AS CHAR(10)), VEH_IDENT_NBR, OPTN_CD, VIN_TYPE_CD,...
2
5944
by: iwl | last post by:
Hello, I'm just starting with Python - would like to embed it in my windows-programm as an script-processor. For tests I use easygui some easy-wrapper for the py-tck-stuff. PyRun_SimpleString("from easygui import *\n"); PyRun_SimpleString("import sys\n"); PyRun_SimpleString("msgbox()\n");
0
984
by: sndive | last post by:
I want to step into PyImport_ImportModule("my_foo") that's failing despite the my_foo.py being in the current directory. (PyRun_SimpleFileEx works on the exact same file). How would I run configure to build libpython with -g? I wonder if I should just keep using PyRun_SimpleFileEx. I want to be able to call arbitrary functions in the imported file/module
0
1008
by: iwl | last post by:
Hi, it seems like I can't trace scripts run by PyRun_SimpleString(): a=0 def test(frame, event, arg): global a a+=1 import sys
3
6398
by: ShambhuHubli | last post by:
Hi all!! .. I am New member to this group. And also new to C/PYTHON API coding. I am trying to have two way communication i,e i am calling from python to C and then from C to python. I have no problem calling c func from python.... But problem is for calling C to Python I am trying to call a python function multiple times by passing one parameter 'fun(param)' from C code . I am getting segmentation fault error while executing . The...
0
8890
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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
9402
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...
1
9182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4521
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...
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.