Link to home
Start Free TrialLog in
Avatar of reh2
reh2

asked on

How do I specify the entry point for a dll written in vb.net?

How do I specify the entry point for a dll written in vb.net?  

I have a project named CardLib with one file named Main.vb (and of course AssemblyInfo.vb).  I want the entry point to be the function DecryptCard in main.vb.

I'm asking because when I try to register the dll with regsvr32 I get the message:

"cardlib.dll was loaded, but the DLllRegisterServer entry point was not found. This file can not be registered."

Also, when I try to call the dll, I get a message saying "Cannot find entry point DecryptCard in the DLL."

So I assume I'm asking the right question.

Can you tell me how to do that?

Thanks.

Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

.Net DLLs cannot be registered!
Avatar of reh2
reh2

ASKER

I still need an entry point to call it from foxpro, so can you tell me how to specify the entry point for a dll written in vb.net?
Are you trying to create a com component? Foxpro lets you use com components. That may be easier than creating a dll with an entry point.

AT
Avatar of reh2

ASKER

Athapa,
Does Foxpro 6.0 let you get values returned from com components? That's what I need to do. If so, can you give me an example how to call one and get a value returned?
Thanks.
reh
Avatar of reh2

ASKER

Athapa,
Looking at the .net help it looks to me like automation-enabled com objects can only be written in c++, or am I wrong on that?
I need to do the .net end in vb.net
reh
Yes.  You can do this.  However, it's not simple for DLL's that are used outside of Internet Explorer.

You will probably want a couple of books that I'd recommend:

.NET and COM: The Complete Interoperability Guide (Paperback)
http://www.amazon.com/exec/obidos/tg/detail/-/067232170X/qid=1120831521/sr=8-1/ref=pd_bbs_ur_1/104-8044258-6976753?v=glance&s=books&n=507846

and

COM Programming with Microsoft .NET (Paperback)
http://www.amazon.com/exec/obidos/tg/detail/-/0735618755/ref=pd_sim_b_4/104-8044258-6976753?%5Fencoding=UTF8&v=glance

Likewise, search in MSDN at www.msdn.com for "Com Callable Wrapper" and read up on what you find there:

Calling a .NET Component from a COM Component
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp

Hope this helps,

---Dan---
> let you get values returned from com components?

you can create a "Structure" with some properties and pass it as "ByRef" to a function

Public Structure MyStructure
   Dim var1 As String '// all variables with "Dim" scope are considered as "Public", only in Structures
   Dim var2 As String
End Structure

Dim com As New COMComponent()
Dim struct As New MyStructure()
dom.MyFunction(struct) '// Public Sub MyFunction(ByRef struct As System.Object)


> so can you tell me how to specify the entry point for a dll written in vb.net?

what about putting a "Sub Main" in a class, I'm not 100% sure about it because I've never used it for COM, but you can try...

Public Shared Sub Main()
   '// entry point
End Sub
Avatar of reh2

ASKER

Thanks for the info, everyone, but it seems like we're getting a little off-subject. If I can find out how to specify the entry point for a dll written in vb.net I can register it with Foxpro (thru foxpro's mechanism) and use it without using regsrv32.exe.   MSDN's faqs on this error indicates it may be an error on case or spelling of the function name. This isn't the case, since I cut and pasted the function name and have checked it again.

So, does anyone know how to specify the entry point for a dll written in vb.net?

Thanks.
reh
ASKER CERTIFIED SOLUTION
Avatar of Daniel Van Der Werken
Daniel Van Der Werken
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can get the retturn value as well as any other properties of com component in foxpro.

For example here an excel com component is created and its visible property accessed.

objexcel = createobject ("excel.application")
IF ObjExcel.Visible = .F.  
    ObjExcel.Visible = .T.
EndIf

It is possible to create com component in .net. I had similiar need where .Net class had to be accessed in vb6. I don't think I had to do a whole lot of stuff beside adding few attributes and few changes.

Here are some info on the topic.
http://www.vbdotnetheaven.com/Code/Jun2003/2073.asp

HTH
AThapa