Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:54:48+00:00 2026-05-27T14:54:48+00:00

I have the below structure in my SWIG interface file and thusly my sample.h

  • 0

I have the below structure in my SWIG interface file and thusly my sample.h header file. I’m assuming the sockaddr, ios_boolean and unsigned char definitions from this structure are the reason why I get the below generated classes. If I know the type on that ios_boolean and unsigned char map to on the Java side is there a way to use an %apply to get rid of the generated pointer classes? I tried %apply int {ios_boolean}; but then I get a SWIGTYPE_p_boolean.java. Any ideas?

%rename (Sample) sample_details_t_;
typedef struct sample_details_t_ {               
    ios_boolean                   is_allowed;           
    unsigned char                 mac[11];        
 } sample_t;


 generates:
 SWIGTYPE_p_unsigned_char.java
 SWIGTYPE_p_ios_boolean.java

Exception:

 [exec] ewapi_wrap.c:982: error: `true' undeclared (first use in this function)
 [exec] ewapi_wrap.c:982: error: (Each undeclared identifier is reported only once
 [exec] ewapi_wrap.c:982: error: for each function it appears in.)
 [exec] ewapi_wrap.c:982: error: `false' undeclared (first use in this function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:54:49+00:00Added an answer on May 27, 2026 at 2:54 pm

    You probably want to do something like:

    %include <arrays_java.i>
    %rename (Sample) sample_details_t_;
    %apply bool { ios_boolean };
    typedef struct sample_details_t_ {               
        ios_boolean                   is_allowed;           
        unsigned char                 mac[11];        
     } sample_t;
    

    This wraps mac as short[] (with constraints on the array size) and is_allowed as boolean on the Java side and results in these files:

    Sample.java test.java testJNI.java

    Make sure you delete any old SWIGTYPE_*.java files that are lying around from older versions of your SWIG interface, they won’t get deleted automatically and might fail to compile if you do something like javac *.java.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below a header file for a stack structure. what I don't understand
I have a data structure which is as given below: class File { public
Suppose I have below python file structure: \function_group |-__init__.py |-sub_function1 |----|__init__.py |----|sub_sub_func1.py |----|sub_sub_func2.py |----|sub_sub_func3.py
We have a structure like below: template<size_t size> class Container{ public: char characters[size]; };
I have an xml file with the below structure: <connections> <connection> <serverName>serverName1</serverName> <dbName>dbName1</dbName> </connection>
I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a polygon structure in an sql2005 db as described below. CREATE TABLE
I have below a description of a data structure I need and I want
I currently have a db structure that looks something like what i have below

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.