calling a dll created in vb.net 2010

Just starting out? Need help? Post your questions and find answers here.
epidemicz
User
User
Posts: 86
Joined: Thu Jan 22, 2009 8:05 am
Location: USA
Contact:

calling a dll created in vb.net 2010

Post by epidemicz »

Have been searching and searching with no luck, so it's time so finally post.. Can anyone tell me how to call a vb.net dll in pure basic?

I made a vb.net dll in visual studio 2010 (file->new->project->class library)

It looks like this basically

Code: Select all

Public Class MyClass
    Public Function test()
        Return 12
    End Function
End Class
And in pure basic, I can open the library fine... However, I cannot examine the functions.

Code: Select all

If OpenLibrary(0, "MyDll.dll")
  Debug "Opened Library..."
  returnValue = CallFunction(0, "test")
  Debug "returnValue: " + Str(returnValue)
  CloseLibrary(0)
EndIf
So that returnValue is 0 and I also get 0 when using ExamineLibraryFunctions. Seems like this should be simple, but I'm agitated beyond belief at the moment. Would really appreciate any help! Thanks for your time.
Image
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: calling a dll created in vb.net 2010

Post by IdeasVacuum »

..... I'm often wrong but does that imply dependency on the .Net runtime?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
epidemicz
User
User
Posts: 86
Joined: Thu Jan 22, 2009 8:05 am
Location: USA
Contact:

Re: calling a dll created in vb.net 2010

Post by epidemicz »

IdeasVacuum wrote:..... I'm often wrong but does that imply dependency on the .Net runtime?
Yeah, I'm sure it would. Crazy, but that's not a big deal for me.
Image
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: calling a dll created in vb.net 2010

Post by Shield »

You can't do that that easily. There might be a way using COM but you probably have to
consider if it's worth just to write the app in .NET completely. :wink:
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Project Mayu
User
User
Posts: 20
Joined: Sun Mar 06, 2011 4:58 pm

Re: calling a dll created in vb.net 2010

Post by Project Mayu »

If someone can help port this Power Basic code to Pure Basic, then you can call a Dot Net DLL
http://powerbasic.projectmayu.dyndns.org/
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Re: calling a dll created in vb.net 2010

Post by Rings »

Project Mayu wrote:If someone can help port this Power Basic code to Pure Basic, then you can call a Dot Net DLL
http://powerbasic.projectmayu.dyndns.org/
similar:
http://www.purebasic.fr/english/viewtop ... 12&t=40058
SPAMINATOR NR.1
Project Mayu
User
User
Posts: 20
Joined: Sun Mar 06, 2011 4:58 pm

Re: calling a dll created in vb.net 2010

Post by Project Mayu »

Similar, but a pain in the x to use, you have to register a COM object in order to use it. If not registered, then program will crash.

And that is why I came up with the proper way to do it, if it's there then use it, If not program can still continue.
If you have Powerbasic, then you could make a dll to do it, else translate the code to Purebasic.

I did start translating my code a while back, but stopped due to lack of time, and lack of Purebasic knowledge.
I still want to do it though, so I can run in x64 CPU's.
Post Reply