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

  • SEARCH
  • Home
  • 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 5961849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:01:25+00:00 2026-05-22T19:01:25+00:00

I have a C header to a certain library I need to access. So

  • 0

I have a C header to a certain library I need to access. So I used JNAerator to do the boring transitions of code – after I read that people recommend it these days. Seems to be quite solid from what I see:

public class Z3_apiLibrary implements Library {
public static final String JNA_LIBRARY_NAME = LibraryExtractor.getLibraryPath("z3_api", true, z3_api.Z3_apiLibrary.class);

    public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(JNA_LIBRARY_NAME, com.ochafik.lang.jnaerator.runtime.MangledFunctionMapper.DEFAULT_OPTIONS);

static {
    Native.register(JNA_LIBRARY_NAME);
    }
public static interface Z3_lbool {
public static final int Z3_L_FALSE = -1;
public static final int Z3_L_UNDEF = 0;
public static final int Z3_L_TRUE = 1;
};

public static interface Z3_symbol_kind {
public static final int Z3_INT_SYMBOL = 0;
public static final int Z3_STRING_SYMBOL = 1;
};

The complete code is at my GitHub.

Now I want to instantiate the dll as an object, and pass the header information from my written interface as a wrapper:

public class z3_Solver {

   public static void main(String[] args) {
    Z3_apiLibrary solver = (Z3_apiLibrary) Native.loadLibrary("z3", Z3_apiLibrary.class);
    Z3_apiLibrary config = new Z3_apiLibrary.Z3_config(); // will not work!


   }

To my surprise this isn’t working. .Z3_config() is abstract. mk_config is static and native. So I cannot resolve that either…. Actually I thought to need to pass the Path to the Native.loadLibrary function as a parameter to locate the dll. I put the dll in the same path as the Java class. Which is confusing and I suspect also wrong.

So what’s the right way to instantiate that JNAerator generated interface?

  • 1 1 Answer
  • 1 View
  • 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-22T19:01:26+00:00Added an answer on May 22, 2026 at 7:01 pm

    The header you posted does not define what Z3_config is, it only says DEFINE_TYPE(Z3_config); This header does not have enough information to generate valid binding. Clean up the header, remove all #ifdef etc, include what those types actually should be, and then try generating code again.

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

Sidebar

Related Questions

I have C function prototypes (certain windows api header files) that look like: int
I have a (header only) C++ library that I am looking to port to
I have a header.html which start with session_start();. Then the following code, $_SESSION['cart'][$sw_id] is
I have a header file, lets say Common.h, that is included in all of
I have certain files like header.php and footer.php . I would like to disable
I'm writing a small library in C++ that I need to be able to
I have a UITableView that is styled as a grouped tableView. Under certain circumstances
I have a template matrix class class defined in a header called Matrix.h. Certain
I have some constants defined in a header file that contain the max length
So, I have this code that hasn't been touched since '99, and was made

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.