I hadn't realized that you had provided this exact mechanism as part of your pcall enhancement. Very nice and interesting. Does it work in linux and mac? I thought some hosts would balk at executing machine instructions from data memory.

Although useful in some circumstances, I would recommend that in general following the normal route of generating and using a shared library is prefered.


----- Original Message ----- From: "Oleg Kobchenko" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Saturday, July 14, 2007 12:51 AM
Subject: Re: [Jprogramming] J API


Note that right now you can see and try it with
the pcall addon:

 http://www.jsoftware.com/svn/addons/trunk/general/pcall/test_asm.ijs

The asm codes are parsed by J, put into a noun
and executed. The codes are from output
of assembler or C compiler.


sumProc=: noun asmdefine
;int __stdcall sum(int n, int* y)
 00050 55 push ebp
 00051 8b ec mov ebp, esp
 00055 33 c0 xor eax, eax
....
 0006e c2 08 00 ret 8
)

sum=: [: 'cp2 > i i i *i' pcall (symdat symget <'sumProc') ; (;~#)

  (sum -: +/) i.1e4
1


--- Don Guinn <[EMAIL PROTECTED]> wrote:

Sounds great! Will be watching for j602.

On 7/13/07, Raul Miller <[EMAIL PROTECTED]> wrote:
>
> On 7/13/07, Don Guinn <[EMAIL PROTECTED]> wrote:
> > I thought that cd (15!:0) established a special environment to call a
> DLL
> > and could only interface to DLLs. And the DLL had to reside in a > > library
> as
> > a file of type DLL. How would I use cd to call a program that resided > > in
> a J
> > noun?
>
> As I understand it:
>
> [*] cd brings an image of the DLL into the current environment.
>
> [2] j6.02 which should have the option of referring to pre-existing > memory
> (other than a DLL).
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm





____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
----------------------------------------------------------------------
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