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 7834525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:14:11+00:00 2026-06-02T13:14:11+00:00

Let us consider that we need to pass a structured form of callbacks to

  • 0

Let us consider that we need to pass a structured form of callbacks to native code dll.
One of the callbacks has the following form in C notation:

int myfunc (int arg1,int* arg2,int arg3,int arg4);//it is marked as stdcall in real app

Here arg2 is an array of ints. arg1 determines the number of elements in arg2.

Here is Java code:

 public class TRCallbackCollection extends Structure{
       public int fieldsCount;    
       public StdCallLibrary.StdCallCallback myfunc;
//...
    }
//...
TRCallbackCollection callbacks= new   TRCallbackCollection();
callbacks.fieldsCount = 7;       
callbacks.myfunc = new StdCallLibrary.StdCallCallback(){
 public int callback (int arg1, int[] arg2,int arg3,int arg4) {            
  return 0;
 }
};

I’ve got the followin error:

java.lang.IllegalArgumentException: Structure field “myfunc” was
declared as interface
com.sun.jna.win32.StdCallLibrary$StdCallCallback, which is not
supported within a Structure,

when I try to init native dll with the instance of TRCallbackCollection structure:

lib.InitKernel(callbacks,5);

Other callbacks work fine. I think that the problem is linked with int[] arg2 in method. How should I transform it and use as the array within callback?

  • 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-06-02T13:14:12+00:00Added an answer on June 2, 2026 at 1:14 pm

    Success; other StdCallCallback fields worked!

    Fortunately, I’ve solved the problem. I used Pointer arg2 instead of int[] arg2.

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

Sidebar

Related Questions

Consider that I have 1 resource and 2 urls (let's say new one and
I'm writing a module that has several methods. Let's consider this : package MyPackage;
Let's consider the following scenario: a function which can generate code colors from white
Let's consider I have the following code /*...*/ var _fun = fun; fun =
Let's consider we have QWidget that contains QTableWidget (only). So we want to resize
Let's consider the following enum in C# public enum ScrollMode : byte { None
Let's consider following, simplified example: We have 2 tabs withing <rich:tabPanel switchType=ajax> , each
I've got the following problem: I need to write a decorator that would be
I have the following problem: Let's consider we have #define SET callMe #define COLUMN(x)
Let's consider this scenarion: In case that I sinchronize my local folder with latest

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.