MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

problems with dll library

  • To: mathgroup at
  • Subject: [mg129410] problems with dll library
  • From: piotr <kalaipiotrek at>
  • Date: Fri, 11 Jan 2013 22:24:24 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:


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;

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

signX = DefineDLLFunction["signX", "libraryX.dll", "double", {"double"}];

I get a following error:

"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.



  • Prev by Date: Re: Modern Differential Geometry for Mathematica 9
  • Next by Date: Mathematica and Lisp
  • Previous by thread: Re: Modern Differential Geometry for Mathematica 9
  • Next by thread: Mathematica and Lisp