Re: [python-win32] LNK4197 error building c++ extension
On Aug 21, 2018, at 5:59 AM, Robin Becker wrote: > > C:\code\hg-repos\taggstate\REPOS\aggstate>ls build\temp.win-amd64-2.7\Release > _aggstate.exp _aggstate.obj agg25 > _aggstate.lib _aggstate.pyd.manifest > > digging a bit deeper I find taht the problem comes from the exp file and the > linker /EXPORT. It seems that the /EXPORT:init_aggstate can be suppressed for > this build and the warning disappears, but something (I assume the exp) > supplies the export. Certainly the pyd appears to work. Yes, the /EXPORT linker command is just an alias for the .def file. You need to mention the entry point EITHER (1) in a .def file, (2) in a /EXPORT, or (3) with a __declspec(dll export). One and one only. — Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] LNK4197 error building c++ extension
Robin Becker wrote: I am not a great C++ person so as I am building my first C++ extension I am seeing this error which I don't understand > _aggstate.obj : warning LNK4197: export 'init_aggstate' specified multiple times; using first specification > Creating library build\temp.win-amd64-2.7\Release\_aggstate.lib and object build\temp.win-amd64-2.7\Release\_aggstate > .exp It's not an error, it's a warning. And this has nothing to do with C++. Is this your own private project, or is it one I can go look up? I looked in the preprecessor output(_aggstate.i) and see this single occurrence of aggstate_init #line 1191 "_aggstate.cxx" extern "C" __declspec(dllexport) void init_aggstate(void) { aggstate_init(); } is this some feature of C++ or is there a real issue here? My guess is that you have listed "init_aggstate" in the ".def" file that lists the exported functions. That's the first export specification. You are also using __declspec(dllexport) in the function definition, and that's the second export specification. When you use __declspec(dllexport), you don't need the ".def" file. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
[python-win32] LNK4197 error building c++ extension
I am not a great C++ person so as I am building my first C++ extension I am seeing this error which I don't understand > _aggstate.obj : warning LNK4197: export 'init_aggstate' specified multiple times; using first specification >Creating library build\temp.win-amd64-2.7\Release\_aggstate.lib and object build\temp.win-amd64-2.7\Release\_aggstate > .exp I looked in the preprecessor output(_aggstate.i) and see this single occurrence of aggstate_init #line 1191 "_aggstate.cxx" extern "C" __declspec(dllexport) void init_aggstate(void) { aggstate_init(); } is this some feature of C++ or is there a real issue here? creating build\lib.win-amd64-2.7 c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python 27\Libs /LIBPATH:C:\code\hg-repos\taggstate\libs /LIBPATH:C:\code\hg-repos\taggstate\PCbuild\amd64 /LIBPATH:C:\code\hg-r epos\taggstate\PC\VS9.0\amd64 /EXPORT:init_aggstate build\temp.win-amd64-2.7\Release\_aggstate.obj build\temp.win-amd64- 2.7\Release\agg25\src\agg_arc.obj build\temp.win-amd64-2.7\Release\agg25\src\agg_bezier_arc.obj build\temp.win-amd64-2.7 \Release\agg25\src\agg_curves.obj build\temp.win-amd64-2.7\Release\agg25\src\agg_trans_affine.obj build\temp.win-amd64-2 .7\Release\agg25\src\agg_vcgen_contour.obj build\temp.win-amd64-2.7\Release\agg25\src\agg_vcgen_stroke.obj /OUT:build\li b.win-amd64-2.7\_aggstate.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\_aggstate.lib /MANIFESTFILE:build\temp.win-amd64- 2.7\Release\_aggstate.pyd.manifest _aggstate.obj : warning LNK4197: export 'init_aggstate' specified multiple times; using first specification Creating library build\temp.win-amd64-2.7\Release\_aggstate.lib and object build\temp.win-amd64-2.7\Release\_aggstate .exp *PS this also occurs when compiling with 3.7, but there the initializer function is PyInit__aggstate -- Robin Becker ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32