Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
hi my problem is about dereferencing the void* to string so i can display value

so far i have created a dll which exports somefun()



MY.dll in C std calling
void* somefun()
{
  return &eax;
}


this function is then loaded in Javascript via jcstypes for XUL


MYJS.js
C#
function rmorework() {

Components.utils.import("resource://gre/modules/ctypes.jsm");

var lib = ctypes.open("C:\\myapp\\dl1.dll");
var ans= lib.declare("somefun" , ctypes.stdcall_abi , ctypes.int8_t );
alert("generating result.... ");
var ptrs = ans();
alert("MessageBox result : "+ptrs); ////(which is void*)


lib.close();
}



how can i get correct value when dereferencing var ptrs
alert("MessageBox result : "+ptrs);



currently i am getting undefined value for void*
if i change somefun to char in place of void* it works
Posted
Comments
DaveAuld 2-Apr-11 3:37am    
I am not a C guru, but the documentation i have seen for use of void with pointers always shows a space between the void and the * i.e. void * not void*, have you tried that?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900