PC Review


Reply
Thread Tools Rate Thread

How can I use Reflection to call a com made by matlab??

 
 
wenshere
Guest
Posts: n/a
 
      22nd Sep 2005
I wrote such code:
Assembly asm = Assembly.LoadFrom(@"Tools.dll");
The Tools.dll is made by matlab, which contain some fuctions wrote in
matlab.
But it throws a System.BadImageFormatException!

How can I call that dll??
 
Reply With Quote
 
 
 
 
Mattias Sjögren
Guest
Posts: n/a
 
      22nd Sep 2005
>I wrote such code:
>Assembly asm = Assembly.LoadFrom(@"Tools.dll");
>The Tools.dll is made by matlab, which contain some fuctions wrote in
>matlab.


The Load methods on the Assembly class are only for managed
assemblies, not for native DLLs.


>How can I call that dll??


I don't know enough about Matlab to tell how the libraries work. BUt
if it's a regular Win32 DLL you may be able to use P/Invoke. (Search
the docs for Platform Invoke).


Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      22nd Sep 2005
Hi,

Beside of what Mattias said,
IIRC you posted about this a couple of days ago and somebody sent you a
link, it seems that in matlab you can create a COM object with your
functions. if so you need to add the reference to it , to go Project menu/
Add reference/ COM , then select browse and look for your dll ( or your
..tlb ) and the reference. once you get to this point you are ready to go


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



"wenshere" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I wrote such code:
> Assembly asm = Assembly.LoadFrom(@"Tools.dll");
> The Tools.dll is made by matlab, which contain some fuctions wrote in
> matlab.
> But it throws a System.BadImageFormatException!
>
> How can I call that dll??



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a Matlab algorithm from Excel VBA mgravit Webmaster / Programming 0 21st Mar 2011 12:30 PM
Call COM+ method/propety via reflection Waldemar Grzywiñski Microsoft Dot NET Compact Framework 0 27th Sep 2007 07:46 PM
RE: Build reflection call into base class? =?Utf-8?B?Q2lhcmFuIE8nJycnRG9ubmVsbA==?= Microsoft Dot NET Framework 1 9th Jan 2007 07:40 PM
An outgoing call cannot be made since the application is dispatching an input-synchronous call Sagaert Johan Microsoft C# .NET 4 6th Apr 2005 12:12 AM
how to call custom dll made in eVC++ from .Net CF Andrew Jones Microsoft Dot NET Compact Framework 1 11th Aug 2003 12:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:48 PM.