Re: Dll problem
- To: mathgroup at smc.vnet.net
- Subject: [mg73823] [mg73823] Re: Dll problem
- From: "johanes" <lukas.tomsu at seznam.cz>
- Date: Fri, 2 Mar 2007 06:10:54 -0500 (EST)
- References: <er3h7r$f6i$1@smc.vnet.net>
Problem solved: declaration of function DYNMODELTRIM_DLLMAPPING double GetWeight(); had to be changed to extern "C" DYNMODELTRIM_DLLMAPPING double GetWeight(); johanes napsal: > Hi, i'm trying to connect a dll file to Mathematica 5.2. I was able to > get the examples (found in HELP) to work, so there shouln't be > anything wrong with .Net version. > > exapmle: > > In[5]:= > novaFce=DefineDLLFunction["GetWeight","C:\HGS > \libDynModelTrim.dll","double",{}] > > Out[5]= > Function[Null,If[NETLink`DLL`Private`checkArgCount[GetWeight,{##1},0], > Wolfram`NETLink`DynamicDLLNamespace`DLLWrapper2`GetWeight[##1], > $Failed],{HoldAll}] > > after > > In[6]:= > novaFce[] > > i got this error message > > >From In[6]:= > NET::netexcptn: A .NET exception occurred: > System.EntryPointNotFoundException: Unable to find an entry point > named > 'GetWeight' in DLL 'C:\HGS\libDynModelTrim.dll'. > at Wolfram.NETLink.DynamicDLLNamespace.DLLWrapper2.GetWeight(). > > Out[6]= > $Failed > > > > function GetWeight() is declared as: > > > DYNMODELTRIM_DLLMAPPING double GetWeight(); > > > where DYNMODELTRIM_DLLMAPPING is defined: > > > if defined(LIBDYNMODELTRIM_EXPORTS) > > # define DYNMODELTRIM_DLLMAPPING __declspec(dllexport) > > # else > > # define DYNMODELTRIM_DLLMAPPING __declspec(dllimport) > > # endif > > > could DYNMODELTRIM_DLLMAPPING be source if this problem?