🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by mauro Fri, 16 Nov 2007 20:18
DllRegisterServer
#1053
Author: mauro
Date: Fri, 16 Nov 2007 20:18
16 lines
1332 bytes
Dear,

I generated a .dll with BCB6 Update4.
I am trying to use the Windows command regsvr32 to register my dll, by
regsvr32 MyDll.dll
(I also generated the .lib file).

In the past I also generated and used others dll.
The point is that now I need to use a dll in Microsoft Visual Studio 
environment,
and so it seems that the dll registration is necessary to do it.

Any one can help me?
Thanks in advance.

Mauro Russo. 
Re: DllRegisterServer
#1054
Author: Remy Lebeau (TeamB)
Date: Fri, 16 Nov 2007 20:48
23 lines
1888 bytes
"mauro" <m.russo@uniplan.it> wrote in message 
news:473dfb2a$1@newsgroups.borland.com...

> I am trying to use the Windows command regsvr32 to register
> my dll, by regsvr32 MyDll.dll

That only applies to DLLs that host COM objects.  You do not need regsvr32 
for general purpose DLLs.

What kind of DLL did you actually make?

> now I need to use a dll in Microsoft Visual Studio environment,
> and so it seems that the dll registration is necessary to do it.
>
> Any one can help me?

What is the actual problem you are having?  VS uses DLLs the same way BCB 
does, with the only difference being the format of the .lib file when using 
static linking.  Otherwise, the use ofthe DLL is pretty much identical.


Gambit 
Re: DllRegisterServer
#1060
Author: mauro
Date: Sat, 17 Nov 2007 11:35
40 lines
2518 bytes
> What kind of DLL did you actually make?

When I generated the project I chose only the options "C++" and 
multi-thread.
I am able to use the DLL from Borland.
Really, I am very interested to learn how to export classes from a DLL. In 
fact,
my DLL has a class to export, but I did not know how to do it and so I 
exported
functions to manage the class. Then, when we used in Borland Delphi, we used 
a
Delphi class which uses the exported function, in order to have in Delphi a 
class
exactly as that in the DLL. I believe it is not a good way to do, but I 
repeat you
that I do not know how to export classes from a DLL. I would like to learn 
it.

> What is the actual problem you are having?  VS uses DLLs the same way BCB 
> does, with the only difference being the format of the .lib file when 
> using static linking.  Otherwise, the use ofthe DLL is pretty much 
> identical.

The problem are because it is the first time we are trying to use a DLL from 
Borland
to VS. I thought it could be easy as when using from Borland to Borland, as 
you say.
My friend, working on VS, is used to register every DLL.
He thinks that he needs to register the DLL in order to use it.
I believe the point is that he is using C# and so I could not tell him
how to translate in C# the way I use in C++ to use the DLL (that is
including the .h file with the declarations <extern "C" 
__declspec(dllimport) __stdcall MyType MyFunc(MyParams);>
It is the first time both of us use C#.

> Gambit

Thank you.
Mauro 
Re: DllRegisterServer
#1072
Author: Remy Lebeau (TeamB)
Date: Sun, 18 Nov 2007 20:36
52 lines
2729 bytes
"mauro" <m.russo@uniplan.it> wrote in message
news:473ed1eb$1@newsgroups.borland.com...

> When I generated the project I chose only the options "C++" and
> multi-thread.

In other words, you use the "File > New > DLL Wizard" option?  If so, then
you do ot need to worry about DllRegisterServer() at all.

> Really, I am very interested to learn how to export classes from a DLL.

You can't.  Even if you could, you wouldn't be able to import them into
non-Borland compilers.

> In fact, my DLL has a class to export, but I did not know
> how to do it

Don't even try to go that route to begin with.

> I exported functions to manage the class.

That is what you have to do.

> Then, when we used in Borland Delphi, we used a Delphi class
> which uses the exported function, in order to have in Delphi a
> class exactly as that in the DLL.

For Delphi and C++Builder, it would be better to make a Package instead of a
DLL.  Then you can use the original class directly.  In order to support
non-Borland compilers, you will have to continue with the function approach.

> My friend, working on VS, is used to register every DLL.

Again, that only applies to DLLs that host COM objects specifically.  It
does not apply to all DLLs in general.  Certainly not the kind of DLL you
have made.

> He thinks that he needs to register the DLL in order to use it.

He's mistaken.

> I believe the point is that he is using C# and so I could not
> tell him how to translate in C# the way I use in C++ to use
> the DLL

.NET languages, such as C#, need to use PInvoke to access unmanaged DLLs.
C++Builder does not produce native .NET assemblies.  You need Delphi.NET for
that.


Gambit
Re: DllRegisterServer
#1073
Author: mauro
Date: Mon, 19 Nov 2007 11:10
40 lines
2322 bytes
>> When I generated the project I chose only the options "C++" and
>> multi-thread.
>
> In other words, you use the "File > New > DLL Wizard" option?  If so, then
> you do ot need to worry about DllRegisterServer() at all.

Yes.

>> Then, when we used in Borland Delphi, we used a Delphi class
>> which uses the exported function, in order to have in Delphi a
>> class exactly as that in the DLL.
>
> For Delphi and C++Builder, it would be better to make a Package instead of 
> a
> DLL.  Then you can use the original class directly.  In order to support
> non-Borland compilers, you will have to continue with the function 
> approach.

We did that, with the class written in Delphi. Really we also wrote a 
discendent class in Delphi
to manage something automatically and we transformed this second class in a 
Package.
Moreover we used that Pascal code compiled in C++ Builder, to obtain an 
equivalent
package.

> .NET languages, such as C#, need to use PInvoke to access unmanaged DLLs.
> C++Builder does not produce native .NET assemblies.  You need Delphi.NET 
> for
> that.

Thank you for the information.
I believe we shall translate the Delphi code in C#.

A last question.
If we use DELPHI .net, we will be able to export classes (in any way, COM 
object, package or everything else)?

Thank you.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads