Question: I have a .NET dll which I use from a C++ program. Now I have to register the dll programmatically on a deployment computer.
How do I do that (programmatically! not using regasm)? I remember, when I once called a VB6 dll from a C++ dll, I had to use DllRegisterServer and DllUnregisterServer.
Is that still so with a .NET dll?
It seems I have to somehow add the dllregisterserver function to the .NET dll.
Registers are faster than memory to access, so the variables which are most frequently used in a C program can be put in registers using register keyword. The keyword register hints to compiler that a given variable can be put in a register. It's compiler's choice to put it in a register or not.
Register variables tell the compiler to store the variable in CPU register instead of memory. Frequently used variables are kept in registers and they have faster accessibility. We can never get the addresses of these variables. “register” keyword is used to declare the register variables.
When should the register modifier be used? Does it really help? The register modifier hints to the compiler that the variable will be heavily used and should be kept in the CPU's registers, if possible, so that it can be accessed faster.
Many devices have multiple internal registers, but only respond to a single address. To access a specific register, the code first needs to write the register number to the device and then perform the required write/read operation. This is not difficult, but needs to be managed carefully.
YUK, .NET dlls don't have DllRegisterServer, so you have to write a .NET installer, executing this somewhere:
Assembly asm = Assembly.LoadFile (@"c:\temp\ImageConverter.dll");
RegistrationServices regAsm = new RegistrationServices();
bool bResult = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With