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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:44:19+00:00 2026-05-24T11:44:19+00:00

I am accessing the DLL from JavaScript using JSCTypes. I have to receive data

  • 0

I am accessing the DLL from JavaScript using JSCTypes. I have to receive data by passing a character buffer to the following API,

__declspec(dllexport) WORD WINAPI receive( LPWORD  lpwBufferSize,
                                           LPSTR   lpsBuffer);

My jsctypes looks like this,

let receive = libs.dll.declare("receive",
                               ctypes.stdcall_abi,  
                               ctypes.int32_t,           // Return type - return code
                               ctypes.int32_t.ptr,       // buffer size
                               ctypes.char.ptr,          // Buffer
                               );
var bufferSize = new ctypes.int32_t(3000000).address(); //3000000
var buffer = new ctypes.char().address();
let rvopen = receive(bufferSize, buffer);
return buffer.readString()

With above code, I could receive data for the first time correctly but xulrunner crashes on receive function call in the subsequent times.
I tried to reproduce this produce this issue with a common DLL available on windows. This throws an exception,
uncaught exception: TypeError: ctypes.char.array(500).address is not a function

var hostName = exports.getString = function() {
    let lib = ctypes.open('Ws2_32.dll');
    let gethostname = lib.declare("gethostname",
                                  ctypes.default_abi,
                                  ctypes.int,
                                  ctypes.char.ptr,
                                  ctypes.int);
    var myArray = ctypes.char.array(500).address();
    gethostname(myArray, 500);
    return myArray.readString();
};

If I drop the address API call and try it as below,

var myArray = ctypes.char.array(64);

I run into this issue, although in C++ arrays are considered as pointers.

‘uncaught exception: TypeError: expected type pointer, got ctypes.char.array(640000)’ in file ” at line 0, col 0

I don’t have access to any of the dll’s source code. I just have the include file(.h) for the DLL. I am a Java developer and not sure if I can debug without the source code
Any help appreciated!

  • 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-24T11:44:19+00:00Added an answer on May 24, 2026 at 11:44 am

    Have finally found a solution,

    <code>
     let charArray= ctypes.ArrayType(ctypes.char);
     let myArray = new charArray(500);      
    </code>
    

    and the function prototype is the same

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

Sidebar

Related Questions

In accessing PDH.dll (a Win32 API) (see link) using P/Invoke , it turns out
Best recommendations for accessing and manipulation of sqlite databases from JavaScript.
I have a .NET assembly which I am accessing from VBScript (classic ASP) via
I have been given an old dll and the assignment of accessing it through
using VB.Net2010 I need to call a C# DLL The problem I have is
I mean accessing it from .NET code, not javascript. Is this just a negative
Currently I am accessing my MFC C++ dll using my python script and everything
When accessing an object in a DataTable retrieved from a database, are there any
When accessing values from an SqlDataReader is there a performance difference between these two:
I'm accessing an Ubuntu machine using PuTTY, and using gcc. The default LANG environment

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.