MatD - Matlab external interface bindings for D

Rainer Schuetze r.sagitario at gmx.de
Sun Aug 22 01:09:47 PDT 2010


Hi,

I have not tried it with the MatLab libraries, but optlink can only 
handle libraries in the omf-format. Libraries in other formats are 
either ignored (in the best case) or cause optlink to exit without 
error, but also without a generated executable.

Trass3r probably used coffimplib 
(ftp://ftp.digitalmars.com/coffimplib.zip) to convert the microsoft 
compatible import libraries to omf format to help optlink.

Rainer


eles wrote:
> Hi,
> 
>  I am interested in using the MatD and mex files in D. Also, if
> possible, to contribute.
> 
>  For the time being, I see that you are distributing a set of
> win32 .lib with MatD. I tried to compile the mex examples you
> provided in Linux 64 bit, but dmd failed to link, I think it is
> because there is a 32 bit compiler (and the Matlab libmex.so
> librariest ec. are 64 bit).
> 
>  Now, coming back to the Win32 environment:
> 
>  I encounter the following problem.
> 
>  On the one hand, when compiling/linking against the libmex.lib and
> libmx.lib files that you provided, a (correct) .dll file (or
> a .mexw32 file) is generated, along with two other files called
> arrayProduct.map and arrayProduct.obj. This is just perfect, the .DLL
> works and is recognized by Matlab (win32 bit) as a MEX file.
> 
>  On the other hand, when compiling/linking against the .lib files
> that come with Matlab (in C:\Matlab\extern\lib\win32\lcc or C:\Matlab
> \extern\lib\win32\microsoft folders), only the arrayProduct.map and
> arrayProduct.obj are created. Where is the .DLL file? Why dmd (2.048)
> does not generate a .DLL file in these cases?
> 
>  Finally, when compiling/linking against the 3rd set of .lib files
> that come with Matlab, namely those in C:\Matlab\extern\lib
> \win32\watcom, a strange thing happens: all three files
> arrayProduct.obj, arrayProduct.map and arrayProduct.DLL are created,
> but the compilation presumably fails since it displays:
> 
> D:\testare_mex_d>dmd arrayProduct.d dllmain.d dlldef.def c:\matlab
> \extern\lib\wi
> n32\watcom\libmex.lib c:\matlab\extern\lib\win32\watcom\libmx.lib
> OPTLINK (R) for Win32  Release 8.00.2
> Copyright (C) Digital Mars 1989-2009  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxGetPr
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxCreateDoubleMatrix
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxGetN
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxGetScalar
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mexErrMsgIdAndTxt
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxGetM
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxGetNumberOfElements
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxIsComplex
> arrayProduct.obj(arrayProduct)
>  Error 42: Symbol Undefined _mxIsDouble
> --- errorlevel 9
> 
> 
>  Why this? Are the .lib files that you are distributing along with
> MatD special in any way?
> 
>  Thanks,
> 
>  eles


More information about the Digitalmars-d-announce mailing list