You'd sent a wild pointer so that a crash is not unexpected.

The C function expects a pointer to pointer, opt**, translating to J601
set=: 2-2
pset=: iad 'set'
setlen=: mo_builtin_settings iad 'pset'

PS. I didn't test the code.

Yuvaraj Athur Raghuvir wrote:
Thanks Bill.

Depends.exe gave me the clue on the procedure name. I picked up the "name"
from the lib file assuming that would be the mangled name.

Next problem:

C code is as follows:

        opt* set = 0;
        int setlen = 0;
        setlen = mo_builtin_settings (&set);

My translation is as follows:
init =: verb define
    s =: 0
    l =: settings <(iad 's')
)

When executed, J crashes!!

The instruction at "0x010d2a40" referenced memory at "0x00000069". The
memory could not be "written"

How to send the memory location that is "writable"?

Thanks,
Yuva


On Fri, Feb 15, 2008 at 4:23 PM, bill lam <[EMAIL PROTECTED]> wrote:

cd does not know anything about the actual protocol of the api function
being
called. It only check if arguments passed to it agree with the signiture.

(procedure not found) means the dll is found but the named function is not
inside the dll so that you have to find what is the real mangled name
using eg.
depend.exe


Yuvaraj Athur Raghuvir wrote:
Hello,

I have been cracking my head on the cd errors. Any help will be
appreciated!!

Context: I want to create a J interop code to MonetDB [1]. I have a
simple C
code running that uses MonetDB in the embedded mode. I want to port that
to
J.

OS : Win XP / 32

To port:
typedef struct opt {
       opt_kind kind;
       char *name;
       char *value;
} opt;
__declspec(dllimport) int mo_builtin_settings(opt **Set);


My J port:
symget=: 15!:6

symdat=: 3 : 0   NB. symdat symget <'name'
had=. {.memr y,(IF64{4 8),1,JPTR
had+{.memr had,0,1,JPTR
)

iad=: [EMAIL PROTECTED]@boxopen


MUTIL =: '"E:\08.utils\monetdb\monetdb01\monetdb01\lib\libmutils.dll"'
cdu =: 1 : '(MUTIL,m)&cd'
settings                =: '_mo_builtin_settings > i i' cdu

init =: verb define
    s =: 0
    l =: settings <(iad 's')
)

Observations:
1) With the above definition, I get cder 2 0
   init ''
|domain error: cd
|   l=:    settings<(iad's')
   cder ''
2 0

2) Just to check if the procedure is getting discovered, I did this:
settings                =: '_mo_builtin_settings > i l' cdu

   init ''
|domain error: cd
|   l=:    settings<(iad's')
   cder ''
5 1

>From this I infer that :
2a)  method is found in the library
2b) the declaration of second parameter is wrong.

Q: Why do I get a 2 0 (procedure not found) error in this case? As far
as I
can see J is able to tell me that the declaration is invalid that tells
me
that the procedure name resolution is ok.

Q: Will I get a 2 0 error on execution of the method due to other
internally
called methods? If so, how can I discover the missing libraries that can
help in the execution?

Note: My C code in VC++ 2005 Express Edition works fine!

Thanks,
Yuva


[1] http://www.monetdb.nl/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

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


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

Reply via email to