Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: problems with dll library
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
kalaipiotrek@gmail.com

Posts: 4
Registered: 11/23/12
problems with dll library
Posted: Jan 11, 2013 10:23 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi,

I have proble which I can not solve for a long time...

I use MinGW compiler to generate dll library - I use a following command to compile a code:

gcc -Wall -shared libraryX.c -o libraryX.dll

in the libraryX.c I put a simple function:

double signX( double x ) {
double s = 0.0;

/*Funtion body*/
if( x > 0.0) s = 1.0;
if( x < 0.0) s = -1.0;

return(s);
}

When I am trying to use this function in Mathematica with a command:

Needs["NETLink`"]
signX = DefineDLLFunction["signX", "libraryX.dll", "double", {"double"}];
signX[1.0]

I get a following error:

NET::netexcptn:
"A .NET exception occurred: \!\(\"System.BadImageFormatException: Probowano zaladowac program w niepoprawnym formacie.
(Wyj\\:0105tek od HRESULT: 0x8007000B)\\n w
Wolfram.NETLink.DynamicDLLNamespace.DLLWrapper16.signX(Double )


Does anybody know how to load such simple funtion in mathematica?

I would be garteful for some hints.

Regards,

Piotr







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.