Hi everyone,

I'm having a sporadic problem white pointer address between J and c++.

I'm running a J64-602 that call some function from a DLL written in c++ compiled for x64.

The call look like this.

llxutm =: '"D:\Infodev\c++\RecDLL\x64\release\RecDLL.dll" LL2UTM + i * * i i i'&cd

       adrY =: mema (#la)*8
       adrX =: mema (#lo)*8

       NB. calling conversion
       llxutm la;lo;adrX;adrY;(#la)

       utmx =: _3 ic memr adrX,0,(#la)*8
       utmy =: _3 ic memr adrY,0,(#la)*8
       memf adrX
       memf adrY

C++ prototype:
DllExport int LL2UTM(double *plat, double *plon,unsigned __int64 *px ,unsigned __int64 *py,unsigned __int64 cnt);

In short, I'm allocating memory for the return value in J (mema), C is calculating the value, and fill in the memory allocated by J. Then J read the value and free the memory.. pretty straightforward.

This call is made about 500 000 to 1 000 000 times, and once in a while (once every 25000 - 50000 call). J create a memory allocation somewhere over the 2^31 boundary . Example : 2552889360 , And then this address is passed to C. But when C received it, it look like this : -1742077936 (0xffffffff982a0010).

This is way below the 2^64 boundary. I'm wondering if J call the DLL passing 64bits value correctly, Or if I'm doing something wrong.

This worked like a charm on 32 bits architecture with a J32.

I' running a Windows XP 64 pro SP2, on a Intel Quad Q6600 64bits, 4GB ram.

regards

Jean-Philippe D.
Software Dev.
Infodev EDI

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to