473,382 Members | 1,563 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,382 software developers and data experts.

Win32 DLL def file question

Hi

How can we export Win32 dll functions for dynamically LoadLibrary and
GetProceeAddress ?

I see VS MFC DLL project has a def file but Win32 DLL does not have one,
should we add a def file to VS Win32 DLL project , how can I do that ?

Thank you .
Aug 7 '08 #1
4 1623
Kid wrote:
Hi

How can we export Win32 dll functions for dynamically LoadLibrary and
GetProceeAddress ?

I see VS MFC DLL project has a def file but Win32 DLL does not have
one, should we add a def file to VS Win32 DLL project , how can I do
that ?

Thank you .
There is another method to export functions apart from def file: keyword
__declspec(dllexport)

http://msdn.microsoft.com/en-us/library/900axts6.aspx
--
Cholo Lennon
Bs.As.
ARG

Aug 7 '08 #2
Cholo Lennon wrote:
Kid wrote:
>Hi

How can we export Win32 dll functions for dynamically LoadLibrary and
GetProceeAddress ?

I see VS MFC DLL project has a def file but Win32 DLL does not have
one, should we add a def file to VS Win32 DLL project , how can I do
that ?

Thank you .

There is another method to export functions apart from def file:
keyword __declspec(dllexport)
But if you want control over the exported names (no mangling) then you must
use a .def file.

Simply specify the file you create under Project Properties -Linker ->
Input -Module Definition File
>
http://msdn.microsoft.com/en-us/library/900axts6.aspx

Aug 7 '08 #3
"Joseph M. Newcomer" <ne******@flounder.comha scritto nel messaggio
news:bs********************************@4ax.com...
There are several ways to avoid name mangling, including using the
extern "C"
declaration in the header files and on the functions themselves.
Joe: if the function is __stdcall, the function name will be decorated as
MSDN documentation explains (also in "extern C" case).

http://msdn.microsoft.com/en-us/libr...93(VS.80).aspx
Note that you have to
use the extern "C" in any case because otherwise the C++ client will
mangle the names. So
a .def file is not necessary (I haven't used a .def file since Win16,
where they were
mandatory, and I do lots of DLLs where name mangling is suppressed and
functions are
exported)
joe

On Thu, 7 Aug 2008 09:44:29 -0500, "Ben Voigt [C++ MVP]"
<rb*@nospam.nospamwrote:
>>Cholo Lennon wrote:
>>Kid wrote:
Hi

How can we export Win32 dll functions for dynamically LoadLibrary and
GetProceeAddress ?

I see VS MFC DLL project has a def file but Win32 DLL does not have
one, should we add a def file to VS Win32 DLL project , how can I do
that ?

Thank you .

There is another method to export functions apart from def file:
keyword __declspec(dllexport)

But if you want control over the exported names (no mangling) then you
must
use a .def file.

Simply specify the file you create under Project Properties -Linker ->
Input -Module Definition File
>>>
http://msdn.microsoft.com/en-us/library/900axts6.aspx
Joseph M. Newcomer [MVP]
email: ne******@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Aug 7 '08 #4
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in
news:Ox**************@TK2MSFTNGP05.phx.gbl:
Cholo Lennon wrote:
>Kid wrote:
>>Hi

How can we export Win32 dll functions for dynamically LoadLibrary
and GetProceeAddress ?

I see VS MFC DLL project has a def file but Win32 DLL does not have
one, should we add a def file to VS Win32 DLL project , how can I
do
that ?

Thank you .

There is another method to export functions apart from def file:
keyword __declspec(dllexport)

But if you want control over the exported names (no mangling) then you
must use a .def file.
Not necessarily. Inside my dll cpp file, I have:
extern "C" __declspec(dllexport) IMyInterface* GetMyInterface()
{
return new MyInterfaceImpl();
}

No def file in sight. (Well, actually there is - but there are no exports
in it - I think I just forgot to remove it after using the wizard to
create the project)

To get the interface:
GETMYINTERFACE func = reinterpret_cast<GETMYINTERFACE>(GetProcAddress
(m_hDllInst, "GetMyInterface"));

where GETMYINTERFACE (defined in the header with IMyInterface) is:
typedef IMyInterface* (*GETMYINTERFACE)();

Now, if you want to specifically export a function at a set ordinal (is
that still possible, or am I just having win16 flashbacks?), you need a
def file.

Dave Connet

Aug 8 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Douard | last post by:
Hi everybody, let me explain by problem: I am working on an application which consists in a C++ dll (numeric computations) and a Python IHM (Python/Tk), which must run under Linux and win32. My...
3
by: Christopher Burr | last post by:
I'm trying to retrieve a string resource from a Win32 file. In win32 world I would just use LoadLibrary and LoadString. What do I use in the .NET world? -- Chris Burr cburr@kcc.com
5
by: Chi Tang | last post by:
Hi, I need to implement a stand alone gui application which need to call some other regular DLL functions (unmanaged code). Should I use .net with C# or just use Win32 API to write this exe? ...
0
by: Bushido Hacks | last post by:
What's that? I've go GCC working for Windows? Well, sort of. But I'm not using a Unix Emulator. The trick is to install Dev-C++, but do not use the Dev-C++ IDE unless you feel like it. I...
0
by: Veli-Pekka Tätilä | last post by:
Hi, My first post here. I've found some serious accessibility flaws in the Python 2.4 docs and wish they could be rectified over time. I'm very new to Python and initially contacted docs at python...
14
by: vittorio | last post by:
While I can compile the program below under freebsd via a simple: gcc prog1.c -o prog1 and it runs smoothly, I'm experiencing annoying problems with lcc-win32 under windows xp pro. In fact, under...
7
by: Robert | last post by:
Hello, I'm using Pythonwin and py2.3 (py2.4). I did not come clear with this: I want to use win32-fuctions like win32ui.MessageBox, listctrl.InsertItem ..... to get unicode strings on the...
48
by: Daniele C. | last post by:
As soon as my sourceforge.net project gets approved, I am going to build a ncurses port to win32 bindable to sockets, e.g. allowing VT100/ANSI terminals and the creation of simple terminal servers...
0
by: =?Utf-8?B?Q29saXZpZXI=?= | last post by:
If anyone can help me with this I would really appreciate it: I have an assembly into which I have linked a manifest file as a Win32 resource. This is necessary since I want to use a class in this...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.