Solved

How to reference a non-COM dll without using DllImport attribute

Posted on 2004-03-23
1
387 Views
Last Modified: 2010-08-05
Is there a way to reference a non-COM dll without using the [DllImport("dllname.dll")] syntax?  I was thinking you could add a reference to a dll and it would essentially create it's own namespace.  Instead, I get an error about the dll not being COM compliant.  The DllImport is fine for smaller dlls.  But if you want to add a dll that contains hundreds of functions, the code becomes pretty bulky and time consuming to create.
0
Comment
Question by:games0802
1 Comment
 
LVL 22

Accepted Solution

by:
_TAD_ earned 50 total points
Comment Utility


I don't think you can....

If this is a .Net (aka "managed") dll, then you can use Assembly.GetAssembly() and pInvoke methods.  If this is another type of dll (aka "un-managed" and compiled to native machine code), then you *have* to use DllImport.

At least... that has always been my understanding.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now