Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51180

Re: how: embed + extend to control my running app?

From Dave Angel <davea@davea.name>
Subject Re: how: embed + extend to control my running app?
Date 2013-07-24 21:14 -0400
References (1 earlier) <mailman.4893.1374282263.3114.python-list@python.org> <823607d0-9365-4dbb-b80c-8221bb514b01@googlegroups.com> <b59q27Fj75iU1@mid.individual.net> <522e7d68-6c26-4036-9389-bc780d792f86@googlegroups.com> <e774c415-534a-432d-a08b-fd9bbe1e5853@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.5076.1374714892.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 07/24/2013 08:51 PM, David M. Cotter wrote:
> update: okay so the python27.dll is in /windows/system32 so ignore that
>
> i've set my include directory correct, so i can compile
>
> i've set my "additional libraries" directory to the "libs" directory (where the ".lib" files are.  (note: NOT including "Lib" directory, cuz that's full of .py files and folders) (note: NOT including "DLLs" directory, cuz, why would i?)
>
> No need to specify "additional dependencies" for the .lib file, cuz the pyconfig.h file does that.
>
> but there is no "python27_d.dll" anywhere to be found, so i hacked pyconfig.h to get rid of the "_d".
>
> so it all compiles.
>
> but it won't link:
>
> 	LNK2001: unresolved external symbol __imp___Py_RefTotal
> 	LNK2001: unresolved external symbol __imp___Py_NoneStruct
> 	LNK2019: unresolved external symbol __imp__PyArg_ParseTuple
> 	LNK2019: unresolved external symbol __imp__PyFloat_FromDouble
> 	LNK2019: unresolved external symbol __imp__PyString_FromString
> 	LNK2019: unresolved external symbol __imp__PyRun_SimpleStringFlags
> 	LNK2019: unresolved external symbol __imp__Py_InitModule4TraceRefs
> 	LNK2019: unresolved external symbol __imp__Py_Initialize
> 	LNK2019: unresolved external symbol __imp__Py_SetProgramName
> 	LNK2019: unresolved external symbol __imp__Py_Finalize
> 	LNK2019: unresolved external symbol __imp__PyRun_SimpleFileExFlags
>
> what, pray tell, am i doing wrong?  *hopeful face*
>

Digging *far* back in my Windows memory, those look like imports.  You 
probably need the import lib for the Python.dll.  Probably called 
somethng like python.lib.   You could check that by doing a dumpbin of 
python.dll and searching for those entry points.

An import lib in Windows simply tells the linker that those symbols will 
be resolved at runtime, and from a particular dll. They can also change 
the names to be used (removing the __imp__ prefix) and even specify a 
numeric entry point (to slow down people who reverse engineer these things).

If I recall right, there's a way in Microsoft's toolset to create an 
import lib from a dll, assuming the dll doesn't restrict itself to those 
numeric thingies.

As for the _d suffix, that's commonly used to specify debug versions of 
things.  They would have extra symbol information, and less optimized 
code so that it's easier to use a debugger on them.


-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-19 16:52 -0700
  Re: how: embed + extend to control my running app? Chris Angelico <rosuav@gmail.com> - 2013-07-20 11:04 +1000
    Re: how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-23 22:15 -0700
      Re: how: embed + extend to control my running app? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-07-24 22:53 +1200
        Re: how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-24 09:10 -0700
          Re: how: embed + extend to control my running app? Chris Angelico <rosuav@gmail.com> - 2013-07-25 02:25 +1000
            Re: how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-24 10:40 -0700
              Re: how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-24 12:35 -0700
        Re: how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-24 13:37 -0700
          Re: how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-24 17:51 -0700
            Re: how: embed + extend to control my running app? Dave Angel <davea@davea.name> - 2013-07-24 21:14 -0400
              Re: how: embed + extend to control my running app? "David M. Cotter" <me@davecotter.com> - 2013-07-25 11:24 -0700

csiph-web