Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet

Discussion Groups

Discussion Groups | Matlab DSP | Need help creating a DLL from an M file and accessing its functions from Java

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Need help creating a DLL from an M file and accessing its functions from Java - aebeytin - Feb 1 8:05:26 2008



Hi all,

I am attempting to convert a .M script (or function, preferably) to a
DLL that I can then access via a Java program.  I'm currently using
version 7.1, though my solution needs to work with later versions as
well.  Here's what I have at the moment:

File test.m:
  function [ data ] = test()
  data = 7;

Compiled in MATLAB with the command:
  mcc -W lib:test -T link:lib test

Java access function (uses JNative):
  try {
    JNative testFunc = new JNative(dllLoc, "test");
    // set return value type, invoke, print result, and clean up
  } catch (NativeException e) {
    System.err.println("NativeException accessing DLL.");
    System.err.println(e.getMessage());
  } catch (IllegalAccessException e) { // Print exception info }
The first instruction fails, throws a NativeException, and I get this
message:
  NativeException accessing DLL.
  Function test not found

It seems that there is no function "test" specifically in the DLL. 
How do I compile this DLL so that I can access it in this way, and/or
what do I need to do about the name of the function?  Do I need to use
a different method completely?

Thanks!
Adam


(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )