[mono-vb] Creating instance of VB assembly in native linux c application

Alex Sisson alexs at callview.com
Mon Aug 14 09:24:01 EDT 2006


Thanks for the reply.

Was checking the refences in the VS object browser and noticed that the VB DLL namespace was shown
as VBDLL.SWAN   (VBDLL is the project, SWAN was my namespace), where as in the C# DLL the name space
was just shown as SWAN.

I was calling mono_class_from_name with the name_space parameter as SWAN - changing this to VBDLL.SWAN for the
vb dll made it work.

This seems a little inconsistent, so not sure if VS is doing something wrong by prefixing the project to the namespace for VB assemblies.

Anyway, cheers

-----Original Message-----
From: Rafael Teixeira [mailto:monoman at gmail.com]
Sent: 14 August 2006 13:59
To: Alex Sisson
Cc: mono-vb at lists.ximian.com
Subject: Re: [mono-vb] Creating instance of VB assembly in native linux
c application

Never heard of someone trying to call VB.NET assembly from C by embedding Mono.

Have you tried to call the methods from C# instead of from C?

Also, check that you didn't compile them with incremental linking
(default on debug builds) as it puts an undocumented segment within
the assembly, that prevents Mono from loading the assembly.

Possible culprits, if both tests above pass OK:
++ vbc (the compiler that VS.NET calls) may generate assemblies with
some undocumented characteristic, that Mono doesn't know how to deal
(if such we wan't to know to implement it)
++ some support code in mono's implementation
Microsoft.VisualBasic.dll, doesn't work as needed (doesn't seem to be
it, but alas)

Could you open a bugzilla case with details, and a short VB.NET
assembly that causes the problem (the snippet of code that do your
embedded calling)?


On 8/14/06, alexs <alexs at callview.com> wrote:
> Hi all,
> I'm investigating mono so that we can avoid rewriting VB.NET assemblies  for
> a possible linux port of our software...
> I have created a simple VB.NET assembly with static and instance methods and
> compile is in Visual Studio. On Linux in c, I can load the assembly, and
> invoke the static methods no problems. But when I try and create an
> instance, it fails - well, "mono_class_from_name" is what fails (I'm using
> the right namespace and class name!)...
> If I recreate the  assembly in C# with the same methods, and compile again
> on VS, I can create an instance of it no problems in linux, and can call an
> instance method.
> Does anyone have an ideas as to why this could be?
> Thanks
> Alex
> --
> View this message in context: http://www.nabble.com/Creating-instance-of-VB-assembly-in-native-linux-c-application-tf2102633.html#a5794595
> Sent from the Mono - VB forum at Nabble.com.
> _______________________________________________
> Mono-vb mailing list
> Mono-vb at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-vb

Rafael "Monoman" Teixeira
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw

This message has been scanned for viruses by MailController - www.MailController.altohiway.com

More information about the Mono-vb mailing list