473,507 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to export functions by name for ctype

I'm on Windows with VS2005 testing ctypes on a very simple dll
I create a test.dll project which exports a function fntest(). I don't
touch anything in the autogenerated source and build it. I can load
the dll but can't access the function by its name fntest. Only by
ordinal number or calling getattr with "?fntest@@YAHXZ". How do I
export functions by name? It's probably rather a VS2005 question, but
I'm a bit disappointed ctypes doesn't work with a default export
convention.
Jun 27 '08 #1
2 1605
rych <ry*****@gmail.comwrote:
I'm on Windows with VS2005 testing ctypes on a very simple dll
I create a test.dll project which exports a function fntest(). I don't
touch anything in the autogenerated source and build it. I can load
the dll but can't access the function by its name fntest. Only by
ordinal number or calling getattr with "?fntest@@YAHXZ". How do I
export functions by name? It's probably rather a VS2005 question, but
I'm a bit disappointed ctypes doesn't work with a default export
convention.
I guess you've compiled your DLL with C++ and the above is a C++
mangled name.

Either compile it with C, or export the names in an extern "C" { }
block.
--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jun 27 '08 #2
On 23 Jun, 10:32, Nick Craig-Wood <n...@craig-wood.comwrote:
rych <rych...@gmail.comwrote:
*I'm on Windows with VS2005 testing ctypes on a very simple dll
*I create a test.dll project which exports a function fntest(). I don't
*touch anything in the autogenerated source and build it. I can load
*the dll but can't access the function by its name fntest. Only by
*ordinal number or calling getattr with "?fntest@@YAHXZ". How do I
*export functions by name? It's probably rather a VS2005 question, but
*I'm a bit disappointed ctypes doesn't work with a default export
*convention.

I guess you've compiled your DLL with C++ and the above is a C++
mangled name.

Either compile it with C, or export the names in an extern "C" { }
block.

--
Nick Craig-Wood <n...@craig-wood.com--http://www.craig-wood.com/nick
That fixed it, thank you.
Jun 27 '08 #3

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

Similar topics

13
29452
by: DarkSpy | last post by:
many c++ compilers including "gcc" have not implemented the "export" keyword, but the comeau compilers made it (just i knew). i want to know about: is it too difficult to implement "export"...
205
10458
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
9
2996
by: | last post by:
I have a web page written in asp.net that has multiple datagrids on it that would need to be exported to Excel. Each of the datagrids would be a subset of what the datagrid above it was. Thus...
8
2829
by: DC Gringo | last post by:
I have a simple button that should open another window and export a datagrid to an Excel file. I'm getting: "Name 'window' is not declared." What do I need to declare or import? <INPUT...
3
8015
by: nologin | last post by:
Is it possible to export data exposed by DataView to Excel file for example ? Seba
4
1679
by: Tomek | last post by:
Hi, How could I export data from table or query to excel file in VB.NET? Thanks in advance, Tomek
9
8278
by: TheOne | last post by:
Would anyone please point me to a list of reentrant C library functions? I want to know which C library functions are safe to use inside a signal handler across all platforms. Does GNU C library...
17
7189
by: Fabry | last post by:
Hi All, I'm new of this group and I do not know if this is the correct group for my question. I have a DLL with its export library (.lib) wrote in Borland C++ 6. In borland everything is OK and...
1
6664
by: DennisBetten | last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel. What does this code do: As the title says, this code is capable of...
0
7223
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
7114
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...
0
7321
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,...
1
7034
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...
0
7488
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...
0
5623
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,...
1
5045
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...
0
3191
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...
0
412
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...

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.