List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] DLL
| [MUG] DLL |
|
Author: Bguerrieri
Posted: Thu, 16 May 2002 10:05:19 -0400
|
>> From: "bguerrieri"
Dear MUG
I am hiding behind a fence as I ask this question about calling C
procedures from Maple:
On the Maple site
http://www.mapleapps.com/categories/software/c_code/html/extcm6.html
one has kindly posted part of the answer pertaining to the
multiplication of two matrices.
Granted that their responsibility was not to spend time on the
intricacies of Windows and DLL writing.
If by any chance, you have written the DLL in question, would you
kindly let me know how you did it.
Sincerely,
Bruno Guerrieri
"bguerrieri"
|
| [MUG] RE: DLL |
|
Author: Alec Mihailovs
Posted: Tue, 21 May 2002 03:35:36 -0400
|
>> From: Alec Mihailovs "amihailo"
That depends on the compiler you use.
If you use Visual Studio 6, then the most simple way is
to open Notepad, copy the program 'void multiply',
and save it, say, in C:\MyProjects\MulMat as MulMat.c.
After that, click on Vcvars32.bat located in
C:\Program Files\Microsoft Visual Studio\VC98\Bin
and change the folder to the location of MulMat.c. For the
example above, type
cd C:\MyProjects\MulMat
After that, enter the command producing the dll:
cl -LD -Gz -Gy -FeMulMat.dll MulMat.c -link /export:multiply
Using Maple 7, the example of using the dll in the extcm6.html
should be changed as follows:
> multiplyMatrixModp := define_external(
> 'multiply',
> a::ARRAY(1..i,1..j,integer[4]),
> b::ARRAY(1..j,1..k,integer[4]),
> c::REF(ARRAY(1..i,1..k,integer[4]),RETURN_ONLY),
> i::integer[4],
> j::integer[4],
> k::integer[4],
> p::integer[4],
> LIB="C:/MyProjects/MulMat/MulMat.dll"):
> p := 17:
> A := Matrix(100,100,(i,j)->i+j mod p,datatype=integer[4]):
> B := Matrix(100,100,(i,j)->i*j mod p,datatype=integer[4]):
> C := Matrix(100,100,datatype=integer[4]):
> multiplyMatrixModp(A,B,C,100,100,100,p);
Note that C is not AB, but BA mod 17. For example,
> E:=Matrix([[1,2],[3,4]],datatype=integer[4]);
[1 2]
E := [ ]
[3 4]
> F:=Matrix([[0,1],[2,3]],datatype=integer[4]);
[0 1]
F := [ ]
[2 3]
> G:=Matrix(2,2,datatype=integer[4]):
> multiplyMatrixModp(E,F,G,2,2,2,p);
> G;
[ 3 4]
[ ]
[11 16]
Best wishes,
Alec Mihailovs
http://webpages.shepherd.edu/amihailo/
-----Original Message-----
>> From: "bguerrieri"
I am hiding behind a fence as I ask this question about calling C
procedures from Maple:
On the Maple site
http://www.mapleapps.com/categories/software/c_code/html/extcm6.html
one has kindly posted part of the answer pertaining to the
multiplication of two matrices.
|
Previous by date: [MUG] Re: Print the procedure output from dsolve, Maple User Group
Next by date: [MUG] Question about texturing using Maple, Bguerrieri
Previous thread: [MUG] Legend help in Maple, Christopher
Next thread: [MUG] Question about texturing using Maple, Bguerrieri
|