[Mono-list] ilasm2 can't compile vbbyref marshalled parameter

Sebastien Pouliot sebastien.pouliot at gmail.com
Fri Dec 14 08:14:55 EST 2007

Hello Joe,

On Fri, 2007-12-14 at 00:48 -0500, Joe Mason wrote:
> I'm trying to make some small edits to a closed-source VB app to get
> it running on Linux (the System.Drawing.Image.FromFile "OutOfMemory"
> problem) by disassembling it with monodis and reassembling it with
> ilasm2.

Has the problem been filled in bugzilla.ximian.com ? because AFAIK
there's none in FromFile, unless the file is bad.

FromStream can have some issues on Win32 (only) since the way MS deals
with loading requires the stream to be alive as long as the image.

> ilasm2 gives an "unrecoverable syntax error" on this line (char 75):
>     .method public static  pinvokeimpl ("kernel32" as
> "GetVolumeInformationA" ansi winapi nomangle  lasterr )
>            default int32 GetVolumeInformation (string& marshal
> (vbbyrefstr) lpRootPathName, string& marshal (vbbyrefstr)
> lpVolumeNameBuffer, int32 nVolumeNameSize, int32&
> lpVolumeSerialNumber, int32& lpMaximumComponentLength, int32&
> lpFileSystemFlags, string& marshal (vbbyrefstr)
> lpFileSystemNameBuffer, int16 nFileSystemNameSize)  cil managed
> preservesig
>     {
>     }
> The problem seems to by the "marshal (vbbyrefstr)" tags.  If I remove
> them, it compiles fine (but then dies with a runtime error because it
> can't find a copy of GetVolumeInformation with the correct signature).
>  It also compiles if I change it to "marshal (int32)".

Sounds like another bugzilla issue to me ;-)

> Is there anything I can do to get this compiling?  I assume the
> problem is that vbbyrefstr was added by Visual Basic and ilasm2
> doesn't recognize it - is there a fully-qualified type name I can
> change it to?  (I can also change the call site to call marshalling
> functions by hand if I have to, but I'm not sure where to start with
> that.)

Have a look at pinvoke.net

> Thanks,
> Joe
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

More information about the Mono-list mailing list