Hi, This isn't an easy question, actually it's very tough and I expect
only very experienced programmers to know the answer. I'm trying to
use the modulen function to let sas connect and use a dll. My dll
takes as an input a pointer and an integer and returns a pointer. Here
is the code of the dll that I called sas.dll:
#ifdef BUILD_DLL
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __declspec(dllimport)
#endif
#include <stdio.h>
#include <stdlib.h>
EXPORT double __stdcall *test (double *x, int n)
{
double *end=malloc((n+5)*sizeof(double));
int i;
for (i=0; i<n;i++)
{
*end=x[i]*2;
}
return(end);
}
Now from SAS I use:
filename sascbtbl catalog 'work.api.ZIAD';
data _null_;
file sascbtbl;
input;
put _infile_;
cards4;
routine test
minarg=2
maxarg=2
stackpop=called
module=sas
returns=long;
arg 1 num input byaddr format=RB8. ;
arg 2 num input byvalue format=PIB4. ;
;;;;
run;
data _null_;
array vals(4) (12 2 13 4);
rc= modulen ('*e', 'test',vals(1),1);
put rc=;
testme=peek(rc,8);
put testme=;
run;
This works well. Giving: rc=72351536 and testme=24
But I am just giving one values as an argument to the sas.dll. What I
want is to directly pass the WHOLE array arr as an argument (pointer)
and then use something like
rc= modulen ('*e', 'test', {WRONG SYNTAX ALL ARRAY vals}, 4);
ret1=peek(rc,8) ;
ret2=peek(rc+8,8);
etc..
to read the returned result. Any ideas how?
|
|
0
|
|
|
|
Reply
|
Francogrex
|
12/12/2009 2:44:07 PM |
|
On Sat, 12 Dec 2009 06:44:07 -0800 (PST), Francogrex <franco@grex.org>
wrote:
>Hi, This isn't an easy question, actually it's very tough and I expect
>only very experienced programmers to know the answer. I'm trying to
>use the modulen function to let sas connect and use a dll. My dll
>takes as an input a pointer and an integer and returns a pointer. Here
>is the code of the dll that I called sas.dll:
>#ifdef BUILD_DLL
>#define EXPORT __declspec(dllexport)
>#else
>#define EXPORT __declspec(dllimport)
>#endif
>#include <stdio.h>
>#include <stdlib.h>
>EXPORT double __stdcall *test (double *x, int n)
>{
> double *end=malloc((n+5)*sizeof(double));
You allocate an array of n+5 doubles.
> int i;
> for (i=0; i<n;i++)
> {
> *end=x[i]*2;
You repeatedly store different values in the first element of that
array. Obviously, only the last value stored survives in the element.
The remaining n+4 elements have indeterminate values.
Did you intend instead
end[i] = x[i] * 2;
This will populate the first n elements of the array. The last 5 will
still be indeterminate.
> }
> return(end);
>}
>
>Now from SAS I use:
>
>filename sascbtbl catalog 'work.api.ZIAD';
>data _null_;
> file sascbtbl;
> input;
> put _infile_;
> cards4;
> routine test
> minarg=2
> maxarg=2
> stackpop=called
> module=sas
> returns=long;
>
>arg 1 num input byaddr format=RB8. ;
>arg 2 num input byvalue format=PIB4. ;
>;;;;
>run;
>data _null_;
> array vals(4) (12 2 13 4);
> rc= modulen ('*e', 'test',vals(1),1);
> put rc=;
> testme=peek(rc,8);
> put testme=;
>run;
>
>This works well. Giving: rc=72351536 and testme=24
>
>But I am just giving one values as an argument to the sas.dll. What I
>want is to directly pass the WHOLE array arr as an argument (pointer)
>and then use something like
>
>rc= modulen ('*e', 'test', {WRONG SYNTAX ALL ARRAY vals}, 4);
>ret1=peek(rc,8) ;
>ret2=peek(rc+8,8);
>etc..
>to read the returned result. Any ideas how?
--
Remove del for email
|
|
0
|
|
|
|
Reply
|
Barry
|
12/12/2009 4:45:35 PM
|
|
On Dec 12, 5:45=A0pm, Barry Schwarz <schwa...@dqel.com> wrote:
> You allocate an array of n+5 doubles.
>
> > =A0int i;
> > =A0for (i=3D0; i<n;i++)
> > =A0 =A0{
> > =A0 =A0 =A0*end=3Dx[i]*2;
>
> You repeatedly store different values in the first element of that
> array. =A0Obviously, only the last value stored survives in the element.
> The remaining n+4 elements have indeterminate values. =A0
>
> Did you intend instead
> =A0 =A0 =A0end[i] =3D x[i] * 2;
> This will populate the first n elements of the array. =A0The last 5 will
> still be indeterminate.
>
Oops yes it was a typing error while I was typing it here in the
newsgroup; that line above should read: *(end+i)=3Dx[i]*2;
Of course since it is correct in the original C file that compiled to
the sas.dll my stated problem before still remains. Any suggestions?
|
|
0
|
|
|
|
Reply
|
Francogrex
|
12/12/2009 9:17:39 PM
|
|
On Dec 12, 7:44=A0am, Francogrex <fra...@grex.org> wrote:
> Hi, This isn't an easy question, actually it's very tough and I expect
> only very experienced programmers to know the answer. I'm trying to
> use the modulen function to let sas connect and use a dll. My dll
> takes as an input a pointer and an integer and returns a pointer. Here
> is the code of the dll that I called sas.dll:
> #ifdef BUILD_DLL
> #define EXPORT __declspec(dllexport)
> #else
> #define EXPORT __declspec(dllimport)
> #endif
> #include <stdio.h>
> #include <stdlib.h>
> EXPORT double __stdcall *test (double *x, int n)
> {
> =A0 double *end=3Dmalloc((n+5)*sizeof(double));
> =A0 int i;
> =A0 for (i=3D0; i<n;i++)
> =A0 =A0 {
> =A0 =A0 =A0 *end=3Dx[i]*2;
> =A0 =A0 }
> =A0 return(end);
>
> }
>
> Now from SAS I use:
>
> filename sascbtbl catalog 'work.api.ZIAD';
> data _null_;
> =A0 =A0 file sascbtbl;
> =A0 =A0 input;
> =A0 =A0 put _infile_;
> =A0 =A0 cards4;
> =A0 =A0 routine test
> =A0 =A0 =A0 =A0 minarg=3D2
> =A0 =A0 =A0 =A0 maxarg=3D2
> =A0 =A0 =A0 =A0 stackpop=3Dcalled
> =A0 =A0 =A0 =A0 module=3Dsas
> =A0 =A0 =A0 =A0 returns=3Dlong;
>
> arg 1 num input byaddr format=3DRB8. ;
> arg 2 num input byvalue format=3DPIB4. ;
> ;;;;
> run;
> data _null_;
> =A0 =A0 array vals(4) (12 2 13 4);
> =A0 =A0 =A0 =A0 rc=3D =A0modulen ('*e', 'test',vals(1),1);
> =A0 =A0 =A0 =A0 put rc=3D;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 testme=3Dpeek(rc,8);
> =A0 =A0 =A0 =A0 put testme=3D;
> run;
>
> This works well. Giving: rc=3D72351536 and testme=3D24
>
> But I am just giving one values as an argument to the sas.dll. What I
> want is to directly pass the WHOLE array arr as an argument (pointer)
> and then use something like
>
> rc=3D =A0modulen ('*e', 'test', {WRONG SYNTAX ALL ARRAY vals}, 4);
> ret1=3Dpeek(rc,8) ;
> ret2=3Dpeek(rc+8,8);
> etc..
> to read the returned result. Any ideas how?
I cannot answer your direct question since I have never used modulen
but let me ask a few questions that might lead to alternatives
(assuming others cannot give a direct response).
1. What O/S are you running on?
2. Can you skip a datastep and use an X command instead?
3. Do you have a data volume problem?
If I need processing external to SAS (which I do on every single
project), I tend to code it up and read in the SAS datasets, process,
then put it back into SAS format. This does not work with large volume
but it is an idea. That way, I control all aspects of the interface.
Alan
http://www.savian.net
|
|
0
|
|
|
|
Reply
|
Savian
|
12/12/2009 10:17:10 PM
|
|
On Dec 12, 11:17=A0pm, Savian <savian....@gmail.com> wrote:
> I cannot answer your direct question since I have never used modulen
> but let me ask a few questions that might lead to alternatives
> (assuming others cannot give a direct response).
>
> 1. What O/S are you running on?
> 2. Can you skip a datastep and use an X command instead?
> 3. Do you have a data volume problem?
>
> If I need processing external to SAS (which I do on every single
> project), I tend to code it up and read in the SAS datasets, process,
> then put it back into SAS format. This does not work with large volume
> but it is an idea. That way, I control all aspects of the interface.
I use winXP. I know how to pipe commands to a cmd, write to external
temp files that other programs can use and spit back their outputs
into sas, but that's not what I want, sorry. I really need to pass an
array as an argument to a dll and get back an array of values in
return. I know how to get an array of values in return (see below),
what is still missing is passing the array to the dll as one argument.
This works because arguments are not pointers
sas.c file:
EXPORT double __stdcall *test (double x, double y,int n)
{
double *end=3Dmalloc((n+5)*sizeof(double));
int i;
for (i=3D0; i<n; i++)
{
*(end+i)=3D(x+y)*i;
}
return(end);
}
filename sascbtbl catalog 'work.api.myfile';
data _null_;
file sascbtbl;
input;
put _infile_;
cards4;
routine test
minarg=3D3
maxarg=3D3
stackpop=3Dcalled
module=3Dsas
returns=3Dlong;
arg 1 num input byvalue format=3DRB8. ;
arg 2 num input byvalue format=3DRB8. ;
arg 3 num input byvalue format=3DPIB4. ;
;;;;
run;
data _null_;
rc =3D modulen ('*e', 'test', 7.3, 4.6, 15);
do i=3D0 to 14*8 by 8;
testme=3Dpeek(rc+i,8);
put testme=3D;
end;
run;
|
|
0
|
|
|
|
Reply
|
Francogrex
|
12/12/2009 10:29:31 PM
|
|
On Dec 12, 3:29=A0pm, Francogrex <fra...@grex.org> wrote:
> On Dec 12, 11:17=A0pm, Savian <savian....@gmail.com> wrote:
>
> > I cannot answer your direct question since I have never used modulen
> > but let me ask a few questions that might lead to alternatives
> > (assuming others cannot give a direct response).
>
> > 1. What O/S are you running on?
> > 2. Can you skip a datastep and use an X command instead?
> > 3. Do you have a data volume problem?
>
> > If I need processing external to SAS (which I do on every single
> > project), I tend to code it up and read in the SAS datasets, process,
> > then put it back into SAS format. This does not work with large volume
> > but it is an idea. That way, I control all aspects of the interface.
>
> I use winXP. I know how to pipe commands to a cmd, write to external
> temp files that other programs can use and spit back their outputs
> into sas, but that's not what I want, sorry. I really need to pass an
> array as an argument to a dll and get back an array of values in
> return. I know how to get an array of values in return (see below),
> what is still missing is passing the array to the dll as one argument.
>
> This works because arguments are not pointers
> sas.c file:
> EXPORT double __stdcall *test (double x, double y,int n)
> {
> =A0 double *end=3Dmalloc((n+5)*sizeof(double));
> =A0 int i;
> =A0 for (i=3D0; i<n; i++)
> =A0 =A0 {
> =A0 =A0 =A0 *(end+i)=3D(x+y)*i;
> =A0 =A0 }
> =A0 return(end);
>
> }
>
> filename sascbtbl catalog 'work.api.myfile';
> data _null_;
> =A0 =A0 file sascbtbl;
> =A0 =A0 input;
> =A0 =A0 put _infile_;
> =A0 =A0 cards4;
> =A0 =A0 routine test
> =A0 =A0 =A0 =A0 minarg=3D3
> =A0 =A0 =A0 =A0 maxarg=3D3
> =A0 =A0 =A0 =A0 stackpop=3Dcalled
> =A0 =A0 =A0 =A0 module=3Dsas
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 returns=3Dlong;
>
> arg 1 num input byvalue format=3DRB8. ;
> arg 2 num input byvalue format=3DRB8. ;
> arg 3 num input byvalue format=3DPIB4. ;
> ;;;;
> run;
> data _null_;
> =A0 =A0 rc =3D modulen ('*e', 'test', 7.3, 4.6, 15);
> =A0 =A0 =A0 =A0 do i=3D0 to 14*8 by 8;
> =A0 =A0 testme=3Dpeek(rc+i,8);
> =A0 =A0 =A0 =A0 put testme=3D;
> =A0 =A0 =A0 =A0 end;
> run;
Do you have control of the dll or is it 3rd party?
Alan
|
|
0
|
|
|
|
Reply
|
Savian
|
12/12/2009 11:36:31 PM
|
|
On Sat, 12 Dec 2009 13:17:39 -0800 (PST), Francogrex <franco@grex.org>
wrote:
>On Dec 12, 5:45�pm, Barry Schwarz <schwa...@dqel.com> wrote:
>> You allocate an array of n+5 doubles.
>>
>> > �int i;
>> > �for (i=0; i<n;i++)
>> > � �{
>> > � � �*end=x[i]*2;
>>
>> You repeatedly store different values in the first element of that
>> array. �Obviously, only the last value stored survives in the element.
>> The remaining n+4 elements have indeterminate values. �
>>
>> Did you intend instead
>> � � �end[i] = x[i] * 2;
>> This will populate the first n elements of the array. �The last 5 will
>> still be indeterminate.
>>
>
>Oops yes it was a typing error while I was typing it here in the
>newsgroup; that line above should read: *(end+i)=x[i]*2;
>Of course since it is correct in the original C file that compiled to
>the sas.dll my stated problem before still remains. Any suggestions?
Don't retype. Use copy and paste.
--
Remove del for email
|
|
0
|
|
|
|
Reply
|
Barry
|
12/12/2009 11:53:33 PM
|
|
On Dec 13, 12:36=A0am, Savian <savian....@gmail.com> wrote:
> Do you have control of the dll or is it 3rd party?
I make it myself from the C file I showed above.
|
|
0
|
|
|
|
Reply
|
Francogrex
|
12/13/2009 9:17:20 AM
|
|
On Dec 13, 10:17=A0am, Francogrex <fra...@grex.org> wrote:
> On Dec 13, 12:36=A0am, Savian <savian....@gmail.com> wrote:
>
> > Do you have control of the dll or is it 3rd party?
>
> I make it myself from the C file I showed above.
ok since I got no solutions then I guess it's either not possible or
I'll need to ask the sas developers at the sas institute because the
programmers don't seem to know about it.
|
|
0
|
|
|
|
Reply
|
Francogrex
|
12/13/2009 6:21:40 PM
|
|
On Dec 13, 11:21=A0am, Francogrex <fra...@grex.org> wrote:
> On Dec 13, 10:17=A0am, Francogrex <fra...@grex.org> wrote:
>
> > On Dec 13, 12:36=A0am, Savian <savian....@gmail.com> wrote:
>
> > > Do you have control of the dll or is it 3rd party?
>
> > I make it myself from the C file I showed above.
>
> ok since I got no solutions then I guess it's either not possible or
> I'll need to ask the sas developers at the sas institute because the
> programmers don't seem to know about it.
Why not use an X command and pass the array in an XML file? You could
also just pass it as a command line argument but I would use XML
instead. Also consider using C# since you are on Windows. C is very
old school. Yes, it works, but consider alternatives. C# EASILY
handles XML so you could be running it in no time.
Richard D. could answer it but he probably doesn't post on the
weekends.
Alan
|
|
0
|
|
|
|
Reply
|
Savian
|
12/13/2009 8:45:01 PM
|
|
On Dec 13, 12:45=A0pm, Savian <savian....@gmail.com> wrote:
> On Dec 13, 11:21=A0am, Francogrex <fra...@grex.org> wrote:
>
> > On Dec 13, 10:17=A0am, Francogrex <fra...@grex.org> wrote:
>
> > > On Dec 13, 12:36=A0am, Savian <savian....@gmail.com> wrote:
>
> > > > Do you have control of the dll or is it 3rd party?
>
> > > I make it myself from the C file I showed above.
>
> > ok since I got no solutions then I guess it's either not possible or
> > I'll need to ask the sas developers at the sas institute because the
> > programmers don't seem to know about it.
>
> Why not use an X command and pass the array in an XML file? You could
> also just pass it as a command line argument but I would use XML
> instead. Also consider using C# since you are on Windows. C is very
> old school. Yes, it works, but consider alternatives. C# EASILY
> handles XML so you could be running it in no time.
>
> Richard D. could answer it but he probably doesn't post on the
> weekends.
>
> Alan
Hi,
I wish I had a little more time, you asked a very interesting
question, I tend to use strings for communicating with other
languages.
see
http://support.sas.com/techsup/technote/ts353.html
and
http://www.devenezia.com/
Some possible Ideas ( may not work)
1. I think you could create a exe from a dll and use a pipe with stdin
stdout(see below)
2. Use modelc and pass a very long string using delimited(or non
delimited) hex16. values ie '4F00000000000,56f0000000000'
just decode the values in your C program.
3. Consider using Java to call the dll using 9.2 Java obj?
4. Convert you C program to Java an do something like. Here the Java
concat command is used concatenate two strings. I think you may be
able to call the DLL from java. There is alot more to this on my site.
data _null_;
length s_out $200;
declare JavaObj j1 ('java/lang/String','ABCDE');
declare JavaObj j2 ('java/lang/String','FGHIJ');
j1.callStringMethod ('concat', j2, s_out);
put s_out=3D;
j1.delete(); j2.delete();
run;
WINDOWS (untested code)
where fid contains the highlighted code in the clipboard (highlight
code and put "store;gsub '%alansexe' on a function key)
filename fmt pipe "c:\cpound\fmt.exe < &fid 2>c:\fmt.log"
filename fmt pipe "c:\cpound\fmt.exe < &fid 2>&1"
|
|
0
|
|
|
|
Reply
|
xlr82sas
|
12/14/2009 4:35:15 AM
|
|
Not that I have ever used it, but someone just mentioned using peek or
poke on another thread.
Couldn't you use that to pass the base address of the array to your
function?
On Dec 13, 1:21=A0pm, Francogrex <fra...@grex.org> wrote:
> On Dec 13, 10:17=A0am, Francogrex <fra...@grex.org> wrote:
>
> > On Dec 13, 12:36=A0am, Savian <savian....@gmail.com> wrote:
>
> > > Do you have control of the dll or is it 3rd party?
>
> > I make it myself from the C file I showed above.
>
> ok since I got no solutions then I guess it's either not possible or
> I'll need to ask the sas developers at the sas institute because the
> programmers don't seem to know about it.
|
|
0
|
|
|
|
Reply
|
Tom
|
12/15/2009 10:06:37 PM
|
|
Assuming you are running on a 32 bit platform, you should try the addr()
function. I haven't tried this, but I suggest you do two things:
1) put your data into a _temporary_ array to insure that the values are
stored in contiguous memory locations
2) pass y = addr(yourarry(1));
On a 64 bit platform use addrlong();
Note: addr() returns the address of a numeric variable. Addrlong() returns
the address of a character variable. Whichever, you will need to have
your data be the appropriate type on the SAS side and do any needed
conversions in your dll. Also, addrlong() works in both environments and
is the recommended method for this reason.
HTH.
Jonathan
On Sat, 12 Dec 2009 06:44:07 -0800, Francogrex <franco@GREX.ORG> wrote:
>Hi, This isn't an easy question, actually it's very tough and I expect
>only very experienced programmers to know the answer. I'm trying to
>use the modulen function to let sas connect and use a dll. My dll
>takes as an input a pointer and an integer and returns a pointer. Here
>is the code of the dll that I called sas.dll:
>#ifdef BUILD_DLL
>#define EXPORT __declspec(dllexport)
>#else
>#define EXPORT __declspec(dllimport)
>#endif
>#include <stdio.h>
>#include <stdlib.h>
>EXPORT double __stdcall *test (double *x, int n)
>{
> double *end=malloc((n+5)*sizeof(double));
> int i;
> for (i=0; i<n;i++)
> {
> *end=x[i]*2;
> }
> return(end);
>}
>
>Now from SAS I use:
>
>filename sascbtbl catalog 'work.api.ZIAD';
>data _null_;
> file sascbtbl;
> input;
> put _infile_;
> cards4;
> routine test
> minarg=2
> maxarg=2
> stackpop=called
> module=sas
> returns=long;
>
>arg 1 num input byaddr format=RB8. ;
>arg 2 num input byvalue format=PIB4. ;
>;;;;
>run;
>data _null_;
> array vals(4) (12 2 13 4);
> rc= modulen ('*e', 'test',vals(1),1);
> put rc=;
> testme=peek(rc,8);
> put testme=;
>run;
>
>This works well. Giving: rc=72351536 and testme=24
>
>But I am just giving one values as an argument to the sas.dll. What I
>want is to directly pass the WHOLE array arr as an argument (pointer)
>and then use something like
>
>rc= modulen ('*e', 'test', {WRONG SYNTAX ALL ARRAY vals}, 4);
>ret1=peek(rc,8) ;
>ret2=peek(rc+8,8);
>etc..
>to read the returned result. Any ideas how?
|
|
0
|
|
|
|
Reply
|
jgoldberg (119)
|
12/15/2009 11:41:10 PM
|
|
Soren:
Good catch. Gad, it's been a long time since I programmed in C. Those
were the days...
Your modified code calls the module routine. This is necessary if the
routine called does not return a value. The original code called modulen
and specified the return type as long. Since the C code writes multiple
values directly to memory it's a little obscure which is correct; however,
Franco might try it your way to see if it helps.
On Wed, 16 Dec 2009 02:56:31 -0500, S=?ISO-8859-1?Q?=C3=B8ren?= Lassen
<s.lassen@POST.TELE.DK> wrote:
>Franco,
>
>I do not think your approach is quite the right one.
>Even if you succeed, you would probably have a memory leak,
>as you allocate the return values with malloc, but the
>memory is (as far as I can see) not released again anywhere.
>
>If you want to take data from an array and return the
>data in another array, you should probably let SAS allocate
>both arrays. Something like this:
>
>data x;
> array vals(4) (12 2 13 4);
> array returns (4) 8;
> call module('*e','test',vals(1),returns(1),4);
>run;
>
>That way, SAS will take care of allocating and deallocating the
>memory.
>
>Your C routine would then look something like
>
>EXPORT void test (double *inarray,
> double *outarray,
> int n)
>{
> int i;
> for (i=0; i<n;i++)
> {
> outarray[i]=inarray[i]*2;
> }
> return;
>}
>
>Of course, the call may be made more elegant and foolproof by
>putting it in a macro:
>
>%macro doublearray(inarray,outarray,
> n=min(dim(&inarray),dim(&outarray)) );
> call module('*e','test',
> &inarray(lbound(&inarray)),
> &outarray(lbound(&outarray)),
> &n)
>%mend;
>
>Regards,
>Søren
>
>
>On Sat, 12 Dec 2009 06:44:07 -0800, Francogrex <franco@GREX.ORG> wrote:
>
>>Hi, This isn't an easy question, actually it's very tough and I expect
>>only very experienced programmers to know the answer. I'm trying to
>>use the modulen function to let sas connect and use a dll. My dll
>>takes as an input a pointer and an integer and returns a pointer. Here
>>is the code of the dll that I called sas.dll:
>>#ifdef BUILD_DLL
>>#define EXPORT __declspec(dllexport)
>>#else
>>#define EXPORT __declspec(dllimport)
>>#endif
>>#include <stdio.h>
>>#include <stdlib.h>
>>EXPORT double __stdcall *test (double *x, int n)
>>{
>> double *end=malloc((n+5)*sizeof(double));
>> int i;
>> for (i=0; i<n;i++)
>> {
>> *end=x[i]*2;
>> }
>> return(end);
>>}
>>
>>Now from SAS I use:
>>
>>filename sascbtbl catalog 'work.api.ZIAD';
>>data _null_;
>> file sascbtbl;
>> input;
>> put _infile_;
>> cards4;
>> routine test
>> minarg=2
>> maxarg=2
>> stackpop=called
>> module=sas
>> returns=long;
>>
>>arg 1 num input byaddr format=RB8. ;
>>arg 2 num input byvalue format=PIB4. ;
>>;;;;
>>run;
>>data _null_;
>> array vals(4) (12 2 13 4);
>> rc= modulen ('*e', 'test',vals(1),1);
>> put rc=;
>> testme=peek(rc,8);
>> put testme=;
>>run;
>>
>>This works well. Giving: rc=72351536 and testme=24
>>
>>But I am just giving one values as an argument to the sas.dll. What I
>>want is to directly pass the WHOLE array arr as an argument (pointer)
>>and then use something like
>>
>>rc= modulen ('*e', 'test', {WRONG SYNTAX ALL ARRAY vals}, 4);
>>ret1=peek(rc,8) ;
>>ret2=peek(rc+8,8);
>>etc..
>>to read the returned result. Any ideas how?
|
|
0
|
|
|
|
Reply
|
jgoldberg (119)
|
12/16/2009 3:22:21 PM
|
|
On Dec 13, 1:21=A0pm, Francogrex <fra...@grex.org> wrote:
> On Dec 13, 10:17=A0am, Francogrex <fra...@grex.org> wrote:
>
> > On Dec 13, 12:36=A0am, Savian <savian....@gmail.com> wrote:
>
> > > Do you have control of the dll or is it 3rd party?
>
> > I make it myself from the C file I showed above.
>
> ok since I got no solutions then I guess it's either not possible or
> I'll need to ask the sas developers at the sas institute because the
> programmers don't seem to know about it.
An example with both C and SAS sources can be found at
http://www.devenezia.com/downloads/sas/sascbtbl
In the GetProcessChildWindows sample, the key bit of source is:
rccw =3D modulen ('GetProcessChildWindows', addr(handle[1,1]), dim1
(handle));
with corresponding a SASCBTBL entry:
~~~
routine GetProcessChildWindows
module =3D rad4sas
minarg =3D 2
maxarg =3D 2
returns =3D long
;
arg 1 input num byvalue format=3Dpib4. ;
arg 2 input num byvalue format=3Dpib4. ;
~~~
byvalue is used for the array because the address of the array is
passed after computing it via the ADDR function
In the rad4sas.c source, the corresponding bit of source is:
DWORD GetProcessChildWindows ( unsigned long *handleArray, unsigned
long nHandles )
--
Richard A. DeVenezia
|
|
0
|
|
|
|
Reply
|
Richard
|
12/24/2009 12:38:32 AM
|
|
|
14 Replies
236 Views
(page loaded in 0.492 seconds)
Similiar Articles: List of PEEKs and POKEs for the C64 - comp.emulators.cbm ...Question for very experienced SAS programmers - comp.soft-sys.sas ... Not that I have ever used it, but someone just mentioned using peek or poke on another thread. Re: Question about read in Excel date data - comp.soft-sys.sas ...... export/dbms=xls and excel lost date format - comp ... Question for very experienced SAS ... Date Formats in Excel using POI - comp.lang.java.programmer ... Re: Question about ... Passing a non-temporary array to a proc fcmp function - comp.soft ...Question for very experienced SAS programmers - comp.soft-sys.sas ..... see below), what is still missing is passing the array to ... use that to pass the base ... Date Formats in Excel using POI - comp.lang.java.programmer ...... It is just very slow so I never ... using POI - comp.lang.java.programmer ... Re: PROC EXPORT excel formatting in SAS ... using POI - comp.lang.java.programmer ... Re: Question ... Determine the size of the Taskbar - comp.os.ms-windows.programmer ...Question for very experienced SAS programmers - comp.soft-sys.sas ... Determine the size of the Taskbar - comp.os.ms-windows.programmer ..... of the Taskbar - comp.os.ms ... using proc export/dbms=xls and excel lost date format - comp.soft ...Re: using proc export/dbms=xls and excel lost date format - comp ... Question for very experienced SAS programmers - comp.soft-sys.sas ... Re: Question about read in Excel ... Excell calling dll with 100% CPU usage - comp.lang.fortran ...Question for very experienced SAS programmers - comp.soft-sys.sas ... I think you may be able to call the DLL from java. There is alot more to this on my site. ... define ODBC data source over command line? - comp.soft-sys.matlab ...Question for very experienced SAS programmers - comp.soft-sys.sas ... Can you skip a datastep and use an X command instead? 3. Do you have a data ... of values in return ... Stored procedures and cursors - comp.databases.mysqlQuestion for very experienced SAS programmers - comp.soft-sys.sas ... Obviously, only the last value stored survives in the ... This works because arguments are not ... Expect 5.45 released - comp.lang.tclQuestion for very experienced SAS programmers - comp.soft-sys.sas ..... an easy question, actually it's very tough and I expect ... franco@grex.org> wrote: >On Dec 12, 5 ... SAS Clinical Programmer required in Bridgewater, NJ - comp.soft ...... Post Question | ... preferably within biotech/pharma Very good knowledge of SAS ... SAS Clinical Programmer required in Bridgewater, NJ - comp ... a unix script to send email notification when a sas batch job ...... it's mainly about unix script, not SAS (a ... (not a homework question, I just know very little about unix scripting ... using a shell script - comp.unix.programmer ... Mailx ... SAS Clinical/Financial/Business Intelligence/Clinical Data ...I am working as a SAS Programmer ... guidance at a very low price. Note: CDM(oracle clinical), SAS BI ... Question about Clinical Data Programming is SAS - sas SAS Clinical ... Comparison of a Simple Join done by EG and Hand Coded - 22 times ...I do believe a very skilled non-EG SQL programmer with the ... I feel a SAS programmer would be better off ... the publications raises many questions from > several SAS ... Drop down to R implementation of Proc Means in the Data Step ...... Post Question | ... works on R data frame objects which are very close to a SAS ... SOAPBOX ON I hope to influence some SAS programmers to ... 133-29: Assessing SAS Skill Level During the Interviewing ProcessWHICH SAS PROCEDURES (PROCS) DO YOU USE AND FOR WHAT PURPOSE? This is a very Open question. An experienced programmer will be able to list a dozen procedures. Interviewing and Assessing SAS Programmerswas based on the input of experienced SAS programmers, managers and instructors. ... are you asking me all these technical questions?” One respondent was very impressed by a ... 7/24/2012 2:44:06 AM
|