Create a dll from a .h file

M

mike.medland

Hi

I am developing a web based application in asp.net and am in the
process of trying to integrate a third party application. The third
party application is supplied in the form of a .h file.

The example they provided is also in C++, which uses the .h file in
question. I would like to create a dll from this .h file which i can
then call from my .Net code. They have provided me with the following
advice about creating a wrapper, which i must admit is a little beyond
my current C++ understanding. I would be grateful if someone could
explain the steps a little clearer to me or suggest a possible
solution. I am currently developing in Visual Studio .Net 2003.

Notes about wrapping the Paper SDK for VS7/VS8:

- The Paper SDK lib\dll directory must be in your path.

- GAPATHOME must be properly set to the GAPAT directory installed by
the FDT (or a copy of that directory).

- The Paper SDK cannot be linked to VC8 libraries; the VC6 linker must
be employed. In other words, both the demo code AND the actual Paper
SDK libraries themselves use template library functions which VC8 does
not know about.

- I wrapped Paper SDK functionality in a VC6 DLL exposing it via
primitive types (char *, int, etc) and then called that VC6 DLL from
VC8 C++ (mixing managed and unmanaged code). The VC8 C++ assembly is
then easily referenced by/callable from .NET 2.0 C# or other managed
code.

- Don't forget that memory allocated in a VC6 DLL must be freed by
that DLL (cannot be freed by VC8 code). Your VC6 wrapper DLL has to
expose a Delete function if it returns pointers to memory it has
allocated.

- You can set GAPATHOME at runtime (using SetEnvironmentVariable)
without having it already set in the environment if (and only if) you
dynamically load the DLL that is linked to the Paper SDK components,
using LoadLibrary and GetProcAddress. If the DLL's load when your
code (app or DLL) is loaded, and then GAPATHOME is set afterwards, it
is too late.

- A similar trick could be employed (with setcwd to set current
directory) to avoid having to have the Paper SDK lib\dll directory on
your PATH.

Thanks in advance

Mikey
 
H

Howard

Hi

I am developing a web based application in asp.net and am in the
process of trying to integrate a third party application. The third
party application is supplied in the form of a .h file.

The example they provided is also in C++, which uses the .h file in
question. I would like to create a dll from this .h file which i can
then call from my .Net code. They have provided me with the following
advice about creating a wrapper, which i must admit is a little beyond
my current C++ understanding. I would be grateful if someone could
explain the steps a little clearer to me or suggest a possible
solution. I am currently developing in Visual Studio .Net 2003.

None of this has anything to do with the C++ language, the subject of this
newsgroup. You need a windows or other microsoft newsgroup. Check on the
news.microsoft.com server.

-Howard
 
R

Robbie Hatley

[How can I] create a dll from a .h file[?]

You can't. A *.dll file is a Dynamically-Linked Library.
It is a collection of machine-language object files.

A *.h file is a list of function prototypes, class definitions,
etc, for a library file. In other words, it's just an interface.

SO... your question amounts to "How can I create a brand new
Volkswagen Bug (in pearlescent teal) from just the dashboard?"
The answer is simple: You can't. You'll have to buy the car.

Same with *.dll files: you need both the *.dll file AND the
corresponding *.h file, and knowledge of how to use them, in
order to use dll files in C++ programs.

For more info, ask in these groups:

comp.os.ms-windows.programmer.misc
comp.os.ms-windows.programmer.win32

--
Cheers,
Robbie Hatley
Tustin, CA, USA
lone wolf intj at pac bell dot net
(put "[usenet]" in subject to bypass spam filter)
home dot pac bell dot net slant earnur slant
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top