473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to export function in namespace to dll

I'm writing a dll for other people ,but I don't wan't to give him codes.
How can I export the function class and namespace in dll .like:
namespace name
{
class a
{
a();
~a();
public :
int fun1(int i);
double b;
};
int fun2(int j);
}
Aug 15 '10 #1

✓ answered by weaknessforcats

You provide the dll in binary form plus a header file. In your example, your header could look like:

Expand|Select|Wrap|Line Numbers
  1. namespace name
  2. {
  3. class a;   //forward reference
  4. int fun1(a* obj,int i);
  5. int fun2(a* obj,int j);
  6. double getb(a* obj);
  7. a* Create();
  8. }
You provide a forward reference for your class. That's enough to allow the compiler to accept an a*. You can't actually create an "a" object without exposing the class and its constructors.

Next, you write a Create function to create and object and return pointer to it. This is a factory. Research the Factory design pattern.

Next, you provide interface functions that can interact with an "a" object whose pointer was obtained from Create. These interfact functions will have pointers to an "a" object argument plus the other arguments.

You are not required to provide an interface function for every method of your class but only the ones the dll users can call.

In effect your header is treating the entire dll as a class and the functions in the header are the methods available in the dll.

1 6579
weaknessforcats
9,208 Expert Mod 8TB
You provide the dll in binary form plus a header file. In your example, your header could look like:

Expand|Select|Wrap|Line Numbers
  1. namespace name
  2. {
  3. class a;   //forward reference
  4. int fun1(a* obj,int i);
  5. int fun2(a* obj,int j);
  6. double getb(a* obj);
  7. a* Create();
  8. }
You provide a forward reference for your class. That's enough to allow the compiler to accept an a*. You can't actually create an "a" object without exposing the class and its constructors.

Next, you write a Create function to create and object and return pointer to it. This is a factory. Research the Factory design pattern.

Next, you provide interface functions that can interact with an "a" object whose pointer was obtained from Create. These interfact functions will have pointers to an "a" object argument plus the other arguments.

You are not required to provide an interface function for every method of your class but only the ones the dll users can call.

In effect your header is treating the entire dll as a class and the functions in the header are the methods available in the dll.
Aug 15 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: adder | last post by:
I would like to create a script that can export ai-files to jpg-files using the export function available in Adobe Illustrator. Can someone tell me how to dispatch the illustrator com-object to...
7
by: Kevin Newman | last post by:
I've been toying with a namespace manager, and wanted to get some input. So what do you think? if (typeof com == 'undefined') var com = {}; if (!com.unFocus) com.unFocus = {}; ...
1
by: seash | last post by:
class xyz{ public void somefunction{ if(this.folderBrowserDialog1.ShowDialog() == DialogResult.OK) { m_varFolderPath = this.folderBrowserDialog1.SelectedPath; m_varFolderPath += ...
3
by: joye | last post by:
Hello, I can use the tool such as dllexp.exe to watch the export functions which built by unmanagedC++, but I can not watch the export function or class built by managedC++ . Who know where has...
1
by: Brad | last post by:
I'm trying to write a utility to export user certificates without user intervention. I found a function CryptUIWizExport that should do the trick but it does not appear to be defined in the...
3
by: rbrian | last post by:
Is there a way to export functions from a VB.Net Dll, similar to the VC _declspec(dllexport) function or .def files, so the functions will show as exported using dumpbin? Any URL to a description...
5
by: JHNielson | last post by:
I have a somewhat simple question, but have been baffled by it for a while, and now I'm on a tight deadline - have to get it done within 24 hours. I am trying to export a set of files to my hard...
1
by: paquer | last post by:
I have a form with a field who's Visible property by default is set to false. If another field meets a certain criteria, then the visible property is set to true. This form shows multiple...
0
by: lanesbalik | last post by:
Hi All, I have DB2 v7.1 running on my linux machine. It try to export my data from my table using EXPORT function but fails. But the strange is when I run it on my local machine running DB2...
6
by: Jeffrey Walton | last post by:
Hi All, Sorry about dropping thish on M.P.D.L.CSharp. There is no M.P.D.L.VC. So I hope someone has come across the issue... How does one export a function (not a class) in a managed Dll? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.