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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:19:12+00:00 2026-06-08T03:19:12+00:00

A C library I’m using has a function which returns a pointer to an

  • 0

A C library I’m using has a function which returns a pointer to an array of char pointers:

extern char** getIds();

The example of use:

char **list, **list_save;
list_save = list = getIds();
while (list && *list)
{
    printf("Id: %s\n", *list);
    list++;
}
freeIds(list_save);

Where freeIds is also from the C library, and frees the memory allocated during getIds.

They provide a .Net Interop assembly too, but it doesn’t import the getIds function. I have access to the interop assembly source code.

My program is in C# so I’d like to know if it possible to add a import to the interop assembly and what it should look like, as well as what my C# code must look like to call the function.

My guess for the dll import is:

[DllImport("foo.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr getIds();

But I haven’t been able to get C# to call it, therefore I don’t know if the dll import is correct.

  • 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-08T03:19:14+00:00Added an answer on June 8, 2026 at 3:19 am

    Have a look at Marshaling char**. Your dllimport should work.

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

Sidebar

Related Questions

The library I'm using has class G and class S which inherits G. I
Which library does GWT use when compiling Java code to JavaScript? (For example ExtGwt
Which library has the definition for the global new and the delete operator? Specifically
A library function parses a file and returns an object. If a parser encounters
Which library do you use for N-dimensional arrays? I use blitz++ at work and
Which library may I use to do it? You can think of it as
Which library should i use to connect my WCF Service (remote) to a Websocket
which library do i need to import to use medianBlur? can someone provide a
My library has dependency on org.ietf.jgss package which is not included in the android.jar.
jaxl library has callbacks to different user defined functions function getId($payload, $jaxl) { <---------

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.