473,769 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetCu rrentDirectory( );
}
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.LoadLibr ary("MyLib");
mylib.getInstan ce.restype = ?
myInst = mylib.getInstan ce();
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 924

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

Similar topics

0
1321
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 being thrown Exception occurred during event dispatching: java.lang.NoClassDefFoundError: java/util/logging/Logger
0
1287
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: java/util/logging/Logger at com.sun.xml.messaging.saaj.soap.MessageFactoryImpl.<clinit>(MessageFactoryImpl.java:36) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Unknown Source) at...
0
2119
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 .bas file - this was converted to .NET class module. To this module we added some cutom transformation tasks. An additional info - we are invoking Comp1 in a loop inside Comp2. The transformation succesfully happens for a few files in the list...
1
6836
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 visible. Let me explain the why i want this. The triger calls a java stored procedure which invokes an external ejbclient which calls the ejb. The ejb queries the database for the modified changes but it is getting old data since commit happens...
6
6181
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at http://groups.google.com/groups?hl=en&lr=&threadm=%23Van7eSrEHA.4004%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26selm%3D%2523Van7eSrEHA.4004%2540TK2MSFTNGP10.phx.gbl I have concluded that my .NET class library (following the suggestions. namely setting the marshall type, etc.) , I can 1) Invoke public methods...
4
2591
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
2017
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 jump to this unmanaged function, but the values of the parameters inside this function Im seeing are not correct(they have some garbage values). //unmanaged class (C++ application)
0
2060
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 don't know how to return the rows the cursor has opened and I don't know how to handle the return set from the proc in my java code. My main problem with that proc is that whether I can retun the result set from the proc without closing the cursor...
1
2235
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 = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; System.Diagnostics.Process.Start("IEXPLORE.EXE", "https://
6
1885
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 command "shell c:\winamp\winamp.exe blah-blah.mp3". It works nicely. I can use this database from a laptop, either by copying the .mdb file to the laptop or by clicking a shortcut that points to the .mdb file on the main machine. The file play...
0
9589
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
10211
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
9994
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
7408
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
6673
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
5298
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
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
3
2815
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.