[Python.NET] Python compare string fucntion

Lalit DIGARI lalit.digari at st.com
Thu Apr 20 13:52:53 CEST 2006


Helllo guys,
Is there any pyhthon function as c's  strcmp function

Regard's
Lalit
-----Original Message-----
From: Mark McMahon [mailto:mark.mcmahon at eur.autodesk.com] 
Sent: Monday, April 03, 2006 5:41 PM
To: Lalit DIGARI; pythondotnet at python.org
Subject: RE: [Python.NET] Use of c++ dll in python


Hi Lalit,

This is not really the group to ask this question - as it doesn't have
anything to do with python.NET.

But other then that I can answer your question I think :-)

You say a "C++ DLL". First thing is you need to make sure that your
functions are correctly exported in an 'unmangled' form. 

What I do for this is the following:

// create a macro DLLEXPORT for those methods you want to export
#define  DLLEXPORT   extern "C" __declspec(dllexport)

// the following may be optional - but can make things easier
#define  VB 	__stdcall

// add the macro to your function prototypes
DLLEXPORT int VB InitDialogFromFile   (char const *const fileName);

// in the CPP file define your function as you would normally do int VB
InitDialogFromFile(char const * const fileName) {
	//FUNC BODY
}

You may also need to create a .def file

; Declares the module parameters for the DLL.
NAME MyCPPDll.dll
DESCRIPTION  'Description of your DLL'
EXPORTS
	// the following line can be used to rename exports
	//InitDialogFromFile_renamed = InitDialogFromFile
	InitDialogFromFile

Once you add that to the project - it will make sure that no mangling
happens (sometimes even after doing extern "C" you still get a leading
underscore!)

Mark


-----Original Message-----
From: pythondotnet-bounces at python.org
[mailto:pythondotnet-bounces at python.org] On Behalf Of Lalit DIGARI
Sent: Monday, April 03, 2006 7:22 AM
To: pythondotnet at python.org
Subject: [Python.NET] Use of c++ dll in python

Hello All ,
I have devloped a c++ dll named mydll in c++ how can I access it with in
python script using ctype... Regard's Lalit

_________________________________________________
Python.NET mailing list - PythonDotNet at python.org
http://mail.python.org/mailman/listinfo/pythondotnet




More information about the PythonDotNet mailing list