[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pnet-developers] [bug #5436] compiler error: using const string in DllI
From: |
nobody |
Subject: |
[Pnet-developers] [bug #5436] compiler error: using const string in DllImport |
Date: |
Fri, 19 Sep 2003 12:12:32 -0400 |
User-agent: |
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322) |
=================== BUG #5436: FULL BUG SNAPSHOT ===================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5436&group_id=353
Submitted by: None Project: DotGNU Portable.NET
Submitted on: Fri 09/19/2003 at 12:12
Category: None Severity: 5 - Major
Bug Group: None Resolution: None
Assigned to: None Status: Open
Summary: compiler error: using const string in DllImport
Original Submission: Hello,
I've noticed that you cannot pass a const string to DllImport for the
libraryname.
<code>
public const string LibName="MyLib";
[DllImport(LibName)] public static extern void Foo();
[DllImport(LibName)] public static extern void Bar();
</code>
this does compile with dotNET but not with dotGNU
cscc error : 'LibName' is not declared in the current scope
The current workaround is that you must pass a literal string to each interop
entry like this:
<code>
[DllImport("MyLib")] public static extern void Foo();
[DllImport("MyLib")] public static extern void Bar();
</code>
Unless the compiler optimizes out the duplicates, this will be extremely
inefficient of memory. Also, the potential for typing/copying errors
increases. If the library name ever changes, you'll need a good search/replace
function.
Cheers,
Oscar
No Followups Have Been Posted
CC list is empty
No files currently attached
For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5436&group_id=353
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pnet-developers] [bug #5436] compiler error: using const string in DllImport,
nobody <=