Home Dashboard Directory Help
Search

Linker - A repeated import table under a different dll. by George Stephanos


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 677627
Opened: 6/29/2011 5:32:13 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

I'm trying to link my C++ application statically against Python 2.7 using the static library provided (libpython27.a).
Builds fine, but when I try to run it, it displays this message:
"The procedure entry point GdipCreateBitmapFromStream could not be located in the dynamic link library python27.dll"
I wondered:
1) How does that function relate to python27.dll ? it's obviously a GDI+ function.
2) Why does it try to link dynamically ?
I opened the EXE using CFF Explorer (a PE explorer) and it displayed 10-15 import descriptors, two of which were python27.dll and gdiplus.dll. All the functions under python27.dll were gdiplus'. On fully removing the python27.dll entry, the application works perfectly.
This didn't seem like anything but a linker bug, so I just straight away reported it here.
Details
Sign in to post a comment.
Posted by Microsoft on 9/19/2011 at 9:14 PM
Hi, we have fixed the problem in our linker and the fix will be included in the next major release of Visual Studio. Before that, you can add linker option /OPT:NOREF to work around this problem.

Thanks for the report.

YongKang Zhu
--
VC++ CodeGen and Tools
Posted by Microsoft on 8/15/2011 at 6:31 PM
The problem of having duplicate (and wrong) import functions from python27.dll seems only to occur under the Release configuration. We are currently investigating. One work-around is to select /OPT:NOREF under "Linker | Optimization" in project's property page.
Posted by Microsoft on 7/4/2011 at 1:10 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.


Posted by George Stephanos on 6/30/2011 at 4:53 PM
Turns out libpython27.a isn't a static library. It's an import library. So there still should be a python27.dll entry in the import table.
Still doesn't explain the GDI+ functions.
Posted by George Stephanos on 6/30/2011 at 3:16 AM
I've attached a demo version of the project.
Also, just tried the Debug configuration. It also builds fine AND generates a working executable - with a correct python27.dll entry, which isn't needed since it's a static link. I removed it and the executable still worked.
I wonder if there's anything wrong with libpython27.a ?
Posted by Microsoft on 6/29/2011 at 10:24 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project to demonstrate this issue so that we can conduct further research?

Please submit this information to us within 4 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by MS-Moderator07 [Feedback Moderator] on 6/29/2011 at 10:03 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 6/29/2011 at 5:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
convertdemo.zip 6/30/2011 1.62 MB