473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Invoking non-static methods of a non-Python object instance

Dear All,

For some time now, I have been working with the ctypes module on
Windows. First I got my hands on a library developed with Delphi 7.
That library is exporting plain functions. Internally, reference is
made to the instance of a class, which is instantiated in a kind of
initialization section. Everything works fine.
Now, I have developed a library in C#. I am able to get the result
from static methods, e.g.
public static String sayHello() {
String msg = "Hello from MyLib, working in folder ";
return msg + Directory.GetCurrentDirectory();
}
To make sure that the libray can work as a Win32 library, I have added
a V-Table by disassembling and then editing the IL code then compiling
again, see: http://www.blong.com/Articles/DotNet...NetInterop.htm

However, in my code I am actually exporting the methods of a class and
I added non-static methods - unlike what was the case with the DLL
developed in Delphi. Unfortunately, it appears impossible to keep a
reference to an instance of my class in the Python code. Suppose, I
remove the keyword "static" from the above method declaration, this
fails whatever I try:
from ctypes import *;
mylib = windll.LoadLibrary("MyLib");
mylib.getInstance.restype = ?
myInst = mylib.getInstance();
print myInst.sayHello();

Is there a way to do this? FYI: I don't want to work with win32client,
because this will require that my users install an extra extension and
I am expected to deliver something which can work without such extra
extensions. I look forward to your ideas!

Kind regards,
Dobedani

Jul 15 '08 #1
0 906

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

Similar topics

0
by: Java Web Services | last post by:
Hi, I am invoking a JAXM SAAJ based Web Service from a Standalone Client.. Sometime back the application was working fine, but suddenly I encountered this exception. This is the exception...
0
by: Java Web Services | last post by:
Hi, I am invoking a JAXM SAAJ Web Service from a Sstandlone Client and this is the error being thrown.. Exception occurred during event dispatching: java.lang.NoClassDefFoundError:...
0
by: Prasad | last post by:
We are invoking a SQL DTS component (lets call it Comp1) built by us in another component (Comp2).Comp1 was built by creating the DTS package using the SQL DTS wizard and then saving it as a VB...
1
by: chandan | last post by:
hi, I have a insert trigger on a table. I want commit to happen after insert before invoking the trigger. So that if a quey is made before the completion of the trigger.Modified Data should be...
6
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at...
4
by: Joanna Carter \(TeamB\) | last post by:
I am trying to invoke an event using reflection. ////////////////////// public class Test { public event EventHandler NameChanged; public void CallEvent() {
0
by: Haxan | last post by:
Hi, I have an unmanaged application that converts a function pointer to a delegate and then pass this as a parameter(delegate) to a managed function which then invokes it. Currently Im able to...
0
by: balaji krishna | last post by:
Hi, I need to handle the return set from COBOL stored procedure from my invoking Java program. I do not know, how many rows the stored proc SQL fetches.I have declared the cursor in that proc, but i...
1
by: imranisb | last post by:
Hi, I apologies if this type of question was posted before. I am invoking internet explorer and open the HTTPS website from my c# application like this: System.Diagnostics.Process proc =...
6
by: John O'Flaherty | last post by:
Hello. I have an ms acess database that I use to track my mp3 files. I have included code that lets me select and play files by invoking an mp3 player (Winamp). This is done by using visual basic...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.