qu | 2 Mar 10:31 2011
Picon
Picon

JNI-Calls failing randomly

Hi all!

I have been using SWIG 2.0.1 for the last weeks quite successfully, nevertheless
i am stuck with a problem now that is a real showstopper and which i have not
been able to resolve for 2 full days now.
Hence my hope that somebody here can give some hints :)

I am wrapping a rather complicated C-application which i have to access from
Java. The C-applications API uses function pointers to enable the use of
callback-functions to inform its user about certain events.
I have successfully used directors for my Java-App to get notified about these
events (this already worked!).
However, i noticed one thing: When running my Java-App in an Eclipse
Debug-Configuration, everything worked well - when using a Run-Configuration,
the application just exited/failed at random locations without error/exception.
Now, recently i did some refactoring within the Java-App as well as my swig
interface-file, rearranging method calls, which then led to the app not working
anymore - not in Debug and neither in Run-Config.
Symptoms: Application just exits at random locations. No error-message, no
exception, nothing.

I debugged into the JNI-Layer as well as the underlying C-Code and noticed that
the exits always occur in the JNI-Layer (in fact always within one of the
function-calls in JNINativeInterface_), also within the native code there are no
exceptions, no error-messages, nothing. The calls just lead to the current
thread exiting with return-code 0.

Since the underlying C-application uses multiple threads and my application
always fails at different locations, my guess is, that this is related to a
threading-issue.
(Continue reading)

Eileen Wei | 2 Mar 17:03 2011

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

Hi,

 

After studying the examples in the python folder, I now started to use SWIG to wrap a C++ file in our software, but I am getting fatal error C1010 when compiling the wrapper file as indicated in the title, and about 30 warnings.

 

I checked the “Precompiled Headers” setting for my project (I am using VS2008), and they are as below:

-          “Create/Use Precompiled Header” is set to “Use Precompiled Header (/Yu)”

-          “Create/Use PCH Through File” is set to “StdAfx.h”

-          “Precompiled Header File” is set to “$(IntDir)\$(TargetName).pch”

 

I think it has included StdAfx.h in the compile, I am very confused why I am getting this error message?

 

///////////////Here is my .i file////////////////////////////

/* File : UgmCalcs.i */

%module UgmCalcs

 

%{

#include "UgmCalcs.h"

%}

 

/* Let's just grab the original header file here */

%include <windows.i>

%include "UgmCalcs.h"

 

///////////////Here is the .h file////////////////////////////

#pragma once

#include "export.h"

 

class EXPORT_UGM_DLL CUgmCalcs

{

public:

    CUgmCalcs( void );

    virtual ~CUgmCalcs( void );

 

      static const double g_dFtToAcreConv;

 

    static bool Xf( const double& dK, const double& dXfSqrtK, double& dXf );

   /*skipped some other similar functions here*/

private:

      //To prevent use of copy and assignment

      CUgmCalcs( const CUgmCalcs&);

      CUgmCalcs& operator=( const CUgmCalcs&);

};

 

///////////////Here is the export.h file////////////////////////////

#ifdef _UGM_DLL

#define EXPORT_UGM_DLL _declspec(dllexport)

#else

#define EXPORT_UGM_DLL _declspec(dllimport)

#endif

 

/* I checked the “Preprocessor Definitions”, and _UGM_DLL is in the list, it seemed that swig added it in somehow, because it wasn’t there before, is that correct? */

 

///////////////Here is the full warning and error messages:///////////////////////////

Warning               1              warning C4005: 'SWIGTEMPLATEDISAMBIGUATOR' : macro redefinition d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  52           UnconventionalAnalysis

Warning               2              warning C4005: 'SWIGINLINE' : macro redefinition            d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  61           UnconventionalAnalysis

Warning               3              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  71           UnconventionalAnalysis

Warning               4              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  74           UnconventionalAnalysis

Warning               5              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  76           UnconventionalAnalysis

Warning               6              warning C4005: 'SWIGUNUSEDPARM' : macro redefinition            d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  90           UnconventionalAnalysis

Warning               7              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  116         UnconventionalAnalysis

Warning               8              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  120         UnconventionalAnalysis

Warning               9              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  122         UnconventionalAnalysis

Warning               10           warning C4005: 'SWIGSTDCALL' : macro redefinition         d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  132         UnconventionalAnalysis

Warning               11           warning C4627: '#include <Python.h>': skipped when looking for precompiled header use                d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx             149                UnconventionalAnalysis

Warning               12           warning C4005: 'SWIG_TYPE_TABLE_NAME' : macro redefinition               d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  168         UnconventionalAnalysis

Warning               13           warning C4005: 'SWIG_Python_str_FromFormat' : macro redefinition     d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  772         UnconventionalAnalysis

Warning               14           warning C4005: 'SWIG_Python_str_DelForPy3' : macro redefinition         d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  800         UnconventionalAnalysis

Warning               15           warning C4005: 'PyOS_snprintf' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  819         UnconventionalAnalysis

Warning               16           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_BLOCK' : macro redefinition    d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1009       UnconventionalAnalysis

Warning               17           warning C4005: 'SWIG_PYTHON_THREAD_END_BLOCK' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1010       UnconventionalAnalysis

Warning               18           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_ALLOW' : macro redefinition  d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1011       UnconventionalAnalysis

Warning               19           warning C4005: 'SWIG_PYTHON_THREAD_END_ALLOW' : macro redefinition       d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1012       UnconventionalAnalysis

Warning               20           warning C4005: 'SWIG_PYTHON_INITIALIZE_THREADS' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1016       UnconventionalAnalysis

Warning               21           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_BLOCK' : macro redefinition    d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1019       UnconventionalAnalysis

Warning               22           warning C4005: 'SWIG_PYTHON_THREAD_END_BLOCK' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1022       UnconventionalAnalysis

Warning               23           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_ALLOW' : macro redefinition  d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1025       UnconventionalAnalysis

Warning               24           warning C4005: 'SWIG_PYTHON_THREAD_END_ALLOW' : macro redefinition       d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1028       UnconventionalAnalysis

Warning               25           warning C4005: 'SWIG_Python_CallFunctor' : macro redefinition               d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1258       UnconventionalAnalysis

Warning               26           warning C4005: 'SWIG_STATIC_POINTER' : macro redefinition     d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1268       UnconventionalAnalysis

Warning               27           warning C4005: 'SWIG_init' : macro redefinition d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  2722       UnconventionalAnalysis

Warning               28           warning C4627: '#include "UgmCalcs.h"': skipped when looking for precompiled header use                d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx             2800                UnconventionalAnalysis

Error      29           fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?      d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  3516       UnconventionalAnalysis

/////////////////////////////////////////////////////////////////////////////////////

 

I would greatly appreciate any help!

 

Thanks,

Eileen

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
William S Fulton | 2 Mar 23:30 2011
Picon

Re: [swig 2.0 regression ?] template extra parenthesis

On 23/02/11 13:40, xantares wrote:
>
> A possible workaround is to remove one of the operator->  from swig interface:
>
> %module example
>
> %inline %{
>
>    template<class T>
>    class SmartPointer
>    {
>    public:
> #ifndef SWIG
>      inline const T * operator ->  () const {}
> #endif
>      inline T * operator ->  () {}
>    };
>
>    class FooImplementation
>    {
>    public:
>    static void Bar();
>    };
>
> %}
>
> %template(FooImplementationSmartPointer) SmartPointer<FooImplementation>;
>
> xantares
>
This is fixed now in trunk for swig-2.0.3.

William

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
David Piepgrass | 3 Mar 00:23 2011

Re: fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

That’s right, SWIG-generated files don’t include StdAfx.h. To remove the error, right-click the *_wrap.cxx file in Visual Studio, click properties and disable precompiled headers (you want “Not Using Precompiled Headers”). I don’t know why you get those warnings though.

 

From: Eileen Wei [mailto:ewei <at> Fekete.com]
Sent: Wednesday, March 02, 2011 9:04 AM
To: swig-user <at> lists.sourceforge.net
Subject: [Swig-user] fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

 

Hi,

 

After studying the examples in the python folder, I now started to use SWIG to wrap a C++ file in our software, but I am getting fatal error C1010 when compiling the wrapper file as indicated in the title, and about 30 warnings.

 

I checked the “Precompiled Headers” setting for my project (I am using VS2008), and they are as below:

-          “Create/Use Precompiled Header” is set to “Use Precompiled Header (/Yu)”

-          “Create/Use PCH Through File” is set to “StdAfx.h”

-          “Precompiled Header File” is set to “$(IntDir)\$(TargetName).pch”

 

I think it has included StdAfx.h in the compile, I am very confused why I am getting this error message?

 

///////////////Here is my .i file////////////////////////////

/* File : UgmCalcs.i */

%module UgmCalcs

 

%{

#include "UgmCalcs.h"

%}

 

/* Let's just grab the original header file here */

%include <windows.i>

%include "UgmCalcs.h"

 

///////////////Here is the .h file////////////////////////////

#pragma once

#include "export.h"

 

class EXPORT_UGM_DLL CUgmCalcs

{

public:

    CUgmCalcs( void );

    virtual ~CUgmCalcs( void );

 

      static const double g_dFtToAcreConv;

 

    static bool Xf( const double& dK, const double& dXfSqrtK, double& dXf );

   /*skipped some other similar functions here*/

private:

      //To prevent use of copy and assignment

      CUgmCalcs( const CUgmCalcs&);

      CUgmCalcs& operator=( const CUgmCalcs&);

};

 

///////////////Here is the export.h file////////////////////////////

#ifdef _UGM_DLL

#define EXPORT_UGM_DLL _declspec(dllexport)

#else

#define EXPORT_UGM_DLL _declspec(dllimport)

#endif

 

/* I checked the “Preprocessor Definitions”, and _UGM_DLL is in the list, it seemed that swig added it in somehow, because it wasn’t there before, is that correct? */

 

///////////////Here is the full warning and error messages:///////////////////////////

Warning               1              warning C4005: 'SWIGTEMPLATEDISAMBIGUATOR' : macro redefinition d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  52           UnconventionalAnalysis

Warning               2              warning C4005: 'SWIGINLINE' : macro redefinition            d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  61           UnconventionalAnalysis

Warning               3              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  71           UnconventionalAnalysis

Warning               4              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  74           UnconventionalAnalysis

Warning               5              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  76           UnconventionalAnalysis

Warning               6              warning C4005: 'SWIGUNUSEDPARM' : macro redefinition            d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  90           UnconventionalAnalysis

Warning               7              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  116         UnconventionalAnalysis

Warning               8              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  120         UnconventionalAnalysis

Warning               9              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  122         UnconventionalAnalysis

Warning               10           warning C4005: 'SWIGSTDCALL' : macro redefinition         d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  132         UnconventionalAnalysis

Warning               11           warning C4627: '#include <Python.h>': skipped when looking for precompiled header use                d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx             149                UnconventionalAnalysis

Warning               12           warning C4005: 'SWIG_TYPE_TABLE_NAME' : macro redefinition               d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  168         UnconventionalAnalysis

Warning               13           warning C4005: 'SWIG_Python_str_FromFormat' : macro redefinition     d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  772         UnconventionalAnalysis

Warning               14           warning C4005: 'SWIG_Python_str_DelForPy3' : macro redefinition         d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  800         UnconventionalAnalysis

Warning               15           warning C4005: 'PyOS_snprintf' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  819         UnconventionalAnalysis

Warning               16           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_BLOCK' : macro redefinition    d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1009       UnconventionalAnalysis

Warning               17           warning C4005: 'SWIG_PYTHON_THREAD_END_BLOCK' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1010       UnconventionalAnalysis

Warning               18           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_ALLOW' : macro redefinition  d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1011       UnconventionalAnalysis

Warning               19           warning C4005: 'SWIG_PYTHON_THREAD_END_ALLOW' : macro redefinition       d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1012       UnconventionalAnalysis

Warning               20           warning C4005: 'SWIG_PYTHON_INITIALIZE_THREADS' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1016       UnconventionalAnalysis

Warning               21           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_BLOCK' : macro redefinition    d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1019       UnconventionalAnalysis

Warning               22           warning C4005: 'SWIG_PYTHON_THREAD_END_BLOCK' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1022       UnconventionalAnalysis

Warning               23           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_ALLOW' : macro redefinition  d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1025       UnconventionalAnalysis

Warning               24           warning C4005: 'SWIG_PYTHON_THREAD_END_ALLOW' : macro redefinition       d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1028       UnconventionalAnalysis

Warning               25           warning C4005: 'SWIG_Python_CallFunctor' : macro redefinition               d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1258       UnconventionalAnalysis

Warning               26           warning C4005: 'SWIG_STATIC_POINTER' : macro redefinition     d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1268       UnconventionalAnalysis

Warning               27           warning C4005: 'SWIG_init' : macro redefinition d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  2722       UnconventionalAnalysis

Warning               28           warning C4627: '#include "UgmCalcs.h"': skipped when looking for precompiled header use                d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx             2800                UnconventionalAnalysis

Error      29           fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?      d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  3516       UnconventionalAnalysis

/////////////////////////////////////////////////////////////////////////////////////

 

I would greatly appreciate any help!

 

Thanks,

Eileen

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Leandro Hermida | 3 Mar 09:02 2011

www.perl.com

Hi everyone,

I just joined the list and am a new SWIG user primarily interested in
Perl targeting.  Just wanted to notify the webmaster that on the
homepage it's better to have the Perl exit link as www.perl.org
instead of www.perl.com, as www.perl.org is the main home of the
programming language

thanks,
Leandro

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
Eileen Wei | 3 Mar 22:15 2011

Re: fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

Thanks David, after changing the precompiled headers the error did go away J

-Eileen

 

From: David Piepgrass [mailto:dpiepgrass <at> mentoreng.com]
Sent: March-02-11 4:24 PM
To: Eileen Wei; swig-user <at> lists.sourceforge.net
Subject: RE: [Swig-user] fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

 

That’s right, SWIG-generated files don’t include StdAfx.h. To remove the error, right-click the *_wrap.cxx file in Visual Studio, click properties and disable precompiled headers (you want “Not Using Precompiled Headers”). I don’t know why you get those warnings though.

 

From: Eileen Wei [mailto:ewei <at> Fekete.com]
Sent: Wednesday, March 02, 2011 9:04 AM
To: swig-user <at> lists.sourceforge.net
Subject: [Swig-user] fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

 

Hi,

 

After studying the examples in the python folder, I now started to use SWIG to wrap a C++ file in our software, but I am getting fatal error C1010 when compiling the wrapper file as indicated in the title, and about 30 warnings.

 

I checked the “Precompiled Headers” setting for my project (I am using VS2008), and they are as below:

-          “Create/Use Precompiled Header” is set to “Use Precompiled Header (/Yu)”

-          “Create/Use PCH Through File” is set to “StdAfx.h”

-          “Precompiled Header File” is set to “$(IntDir)\$(TargetName).pch”

 

I think it has included StdAfx.h in the compile, I am very confused why I am getting this error message?

 

///////////////Here is my .i file////////////////////////////

/* File : UgmCalcs.i */

%module UgmCalcs

 

%{

#include "UgmCalcs.h"

%}

 

/* Let's just grab the original header file here */

%include <windows.i>

%include "UgmCalcs.h"

 

///////////////Here is the .h file////////////////////////////

#pragma once

#include "export.h"

 

class EXPORT_UGM_DLL CUgmCalcs

{

public:

    CUgmCalcs( void );

    virtual ~CUgmCalcs( void );

 

      static const double g_dFtToAcreConv;

 

    static bool Xf( const double& dK, const double& dXfSqrtK, double& dXf );

   /*skipped some other similar functions here*/

private:

      //To prevent use of copy and assignment

      CUgmCalcs( const CUgmCalcs&);

      CUgmCalcs& operator=( const CUgmCalcs&);

};

 

///////////////Here is the export.h file////////////////////////////

#ifdef _UGM_DLL

#define EXPORT_UGM_DLL _declspec(dllexport)

#else

#define EXPORT_UGM_DLL _declspec(dllimport)

#endif

 

/* I checked the “Preprocessor Definitions”, and _UGM_DLL is in the list, it seemed that swig added it in somehow, because it wasn’t there before, is that correct? */

 

///////////////Here is the full warning and error messages:///////////////////////////

Warning               1              warning C4005: 'SWIGTEMPLATEDISAMBIGUATOR' : macro redefinition d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  52           UnconventionalAnalysis

Warning               2              warning C4005: 'SWIGINLINE' : macro redefinition            d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  61           UnconventionalAnalysis

Warning               3              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  71           UnconventionalAnalysis

Warning               4              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  74           UnconventionalAnalysis

Warning               5              warning C4005: 'SWIGUNUSED' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  76           UnconventionalAnalysis

Warning               6              warning C4005: 'SWIGUNUSEDPARM' : macro redefinition            d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  90           UnconventionalAnalysis

Warning               7              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  116         UnconventionalAnalysis

Warning               8              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  120         UnconventionalAnalysis

Warning               9              warning C4005: 'SWIGEXPORT' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  122         UnconventionalAnalysis

Warning               10           warning C4005: 'SWIGSTDCALL' : macro redefinition         d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  132         UnconventionalAnalysis

Warning               11           warning C4627: '#include <Python.h>': skipped when looking for precompiled header use                d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx             149                UnconventionalAnalysis

Warning               12           warning C4005: 'SWIG_TYPE_TABLE_NAME' : macro redefinition               d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  168         UnconventionalAnalysis

Warning               13           warning C4005: 'SWIG_Python_str_FromFormat' : macro redefinition     d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  772         UnconventionalAnalysis

Warning               14           warning C4005: 'SWIG_Python_str_DelForPy3' : macro redefinition         d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  800         UnconventionalAnalysis

Warning               15           warning C4005: 'PyOS_snprintf' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  819         UnconventionalAnalysis

Warning               16           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_BLOCK' : macro redefinition    d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1009       UnconventionalAnalysis

Warning               17           warning C4005: 'SWIG_PYTHON_THREAD_END_BLOCK' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1010       UnconventionalAnalysis

Warning               18           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_ALLOW' : macro redefinition  d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1011       UnconventionalAnalysis

Warning               19           warning C4005: 'SWIG_PYTHON_THREAD_END_ALLOW' : macro redefinition       d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1012       UnconventionalAnalysis

Warning               20           warning C4005: 'SWIG_PYTHON_INITIALIZE_THREADS' : macro redefinition          d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1016       UnconventionalAnalysis

Warning               21           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_BLOCK' : macro redefinition    d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1019       UnconventionalAnalysis

Warning               22           warning C4005: 'SWIG_PYTHON_THREAD_END_BLOCK' : macro redefinition        d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1022       UnconventionalAnalysis

Warning               23           warning C4005: 'SWIG_PYTHON_THREAD_BEGIN_ALLOW' : macro redefinition  d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1025       UnconventionalAnalysis

Warning               24           warning C4005: 'SWIG_PYTHON_THREAD_END_ALLOW' : macro redefinition       d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1028       UnconventionalAnalysis

Warning               25           warning C4005: 'SWIG_Python_CallFunctor' : macro redefinition               d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1258       UnconventionalAnalysis

Warning               26           warning C4005: 'SWIG_STATIC_POINTER' : macro redefinition     d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  1268       UnconventionalAnalysis

Warning               27           warning C4005: 'SWIG_init' : macro redefinition d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  2722       UnconventionalAnalysis

Warning               28           warning C4627: '#include "UgmCalcs.h"': skipped when looking for precompiled header use                d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx             2800                UnconventionalAnalysis

Error      29           fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?      d:\perforce\Core-UAM\commonmodules\UnconventionalAnalysis\UgmCalcs_wrap.cxx  3516       UnconventionalAnalysis

/////////////////////////////////////////////////////////////////////////////////////

 

I would greatly appreciate any help!

 

Thanks,

Eileen

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
William S Fulton | 4 Mar 07:36 2011
Picon

Re: Ruby director question

Whether or not a method body is empty will make no difference, unless
that method calls a base class method of the same name.

William

On 28/02/11 13:04, 何平 wrote:
> Thanks for the reply, William. your suggestion helps. but I found myself 
> rather confused about the director..
> 
> 1. I tried my example again, it actually works. but with the restriction 
> that the implementation of fun() MUST not be empty, which was what I wrote.
> 
> 2. the fun() MUST be called out of original class, which is, cannot be 
> called by this. otherwise it just call the original c++ implementation.
> 
> Well, it smells buggy now :)
> 
> --------------------------------------------------
> From: "William S Fulton" <wsf <at> fultondesigns.co.uk>
> Sent: Monday, February 28, 2011 12:14 AM
> To: "何平" <tdihp <at> hotmail.com>
> Cc: <swig-user <at> lists.sourceforge.net>
> Subject: Re: [Swig-user] Ruby director question
> 
>> On 27/02/11 02:15, 何平 wrote:
>>> Hi, I'm new here and this is my 1st post, so no hard feelings if my
>>> question is really dumb.
>>> SO my *.i file looks like this
>>>
>>> %module(directors="1") mymod
>>> %{
>>> #include "rubywrapper_swig.h"
>>> %}
>>> %feature("nodirector");
>>> %feature("director") MyWorld::fun;
>>> class MyWorld{
>>> public:
>>> MyWorld();
>>> virtual ~MyWorld();
>>> virtual void fun();
>>> };
>>> void myLoop(MyWorld* world);
>>>
>>> for testing purpose, no real loops in myLoop:
>>>
>>> void MyWorld::fun() {}
>>> void myLoop(MyWorld* world) {
>>> world->fun();
>>> }
>>>
>>> and testing script is pretty simple
>>>
>>> require 'mymod'
>>> include Mymod
>>> class World < MyWorld
>>> def mainLogical
>>> puts 'testing...'
>>> end
>>> end
>>> world = World.new
>>> mainLoop(world)
>>>
>>> So, I expect a ''testing...' print rather than nothing, but I got 
>>> nothing...
>>> I'm using ruby 1.9.2, swigwin 2.0.2
>>> please tell me what's wrong?
>>> Thanks
>>>
>>
>> You have directors turned off by default as you have
>> %feature("nodirector");
>> In particular, directors are turned off the MyWorld class. If you want
>> very selective directors, add in:
>>
>> %feature("director") MyWorld;
>>
>> to what you already have.
>>
>> William
>>
> 

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
William S Fulton | 4 Mar 07:42 2011
Picon

www.perl.com

On 03/03/11 08:02, Leandro Hermida wrote:
> Hi everyone,
>
> I just joined the list and am a new SWIG user primarily interested in
> Perl targeting.  Just wanted to notify the webmaster that on the
> homepage it's better to have the Perl exit link as www.perl.org
> instead of www.perl.com, as www.perl.org is the main home of the
> programming language
>

Thanks for pointing out, fixed now.

William

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
Eileen Wei | 4 Mar 16:49 2011

ImportError: DLL load failed: The specified module could not be found.

Hi,

 

I am using SWIG to wrap a C++ file (UgmCalcs.h) into python. I used VS2008 to generate the UgmCalcs.py and _UgmCalcs.pyd (the build is successful). However, when trying to import the UgmCalcs module, I got the following error:

///////////////////////////////////

>>> import UgmCalcs

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "UgmCalcs.py", line 25, in <module>

    _UgmCalcs = swig_import_helper()

  File "UgmCalcs.py", line 21, in swig_import_helper

    _mod = imp.load_module('_UgmCalcs', fp, pathname, description)

ImportError: DLL load failed: The specified module could not be found.

////////////////////////////////////

 

I checked the SWIG manual and don’t see this error mentioned. As I am new to SWIG, can someone please help me on what might be the possible problem and how should I go about investigating further?

 

///////////////Here is my .i file////////////////////////////

/* File : UgmCalcs.i */

%module UgmCalcs

 

%{

#define SWIG_FILE_WITH_INIT

#include "UgmCalcs.h"

%}

 

/* Let's just grab the original header file here */

#define EXPORT_UGM_DLL

%include "UgmCalcs.h"

 

///////////////Here is the UgmCalcs.h file////////////////////////////

#pragma once

#include "export.h"

 

class EXPORT_UGM_DLL CUgmCalcs

{

public:

    CUgmCalcs( void );

    virtual ~CUgmCalcs( void );

 

      static const double g_dFtToAcreConv;

 

    static bool Xf( const double& dK, const double& dXfSqrtK, double& dXf );

   /*skipped some other similar functions here*/

private:

      //To prevent use of copy and assignment

      CUgmCalcs( const CUgmCalcs&);

      CUgmCalcs& operator=( const CUgmCalcs&);

};

 

///////////////Here is the export.h file////////////////////////////

#ifdef _UGM_DLL

#define EXPORT_UGM_DLL _declspec(dllexport)

#else

#define EXPORT_UGM_DLL _declspec(dllimport)

#endif

//////////////////////////////////////////////////////////////////

 

Thanks a lot,

Eileen

 

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Dieter Vandenbussche | 4 Mar 17:57 2011

Python error state cleared

Hi, i'm wrapping a C++ library for use with python.
One of the methods i'm exposing looks something like this:

Foo *toFoo(PyObject *, const Bar &bar);

The implementation of this method calls various Python C-API methods,
one of which happens to fail so that inside toFoo, a call to
PyErr_Occurred() returns true.  When this occurrs, I return NULL.
I was expecting that i would see an exception in Python in this case,
but that is not happening.  Is SWIG calling PyErr_Clear somewhere that
would cause this, or is my expectation incorrect?

thanks for any help
dieter

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d

Gmane