Compiling a DLL? [message #53785] |
Sun, 29 April 2007 13:49 |
wclift01
Messages: 6 Registered: April 2007
|
Junior Member |
|
|
All,
I am attempting to create a dll under 6.3 running under XP SP2. My
compiler is MS VC version 8 (the free express edition). As my test
case I am using the source code to Rick Towler's RHTgrCamera and Ronn
Kling's book "Calling C from IDL" as a reference.
My first problem is that I cannot find export.h in my \RSI
\IDL63\external folder but I did see references elsewhere to
IDL_export.h so with not a little trepidation I used that instead:
Here's the not so reassuring note at the beginning of IDL_export.h:
/* idl_export.h */
/*
* Copyright (c) 1992-2003, Research Systems Inc. All rights
reserved.
* Reproduction by any means whatsoever is prohibited without express
* written permission.
*/
* NOTICE OF INTENT. PLEASE READ:
*
* This file is intended to supply the external definitions
* required to write and link code against IDL, either to extend
* IDL (CALL_EXTERNAL, Dynamically loadable modules, LINKIMAGE) or
* to use IDL to extend your own program (Callable IDL). Our goal
is
* that including this file in your program will enable your
program
* to access the public interfaces described in the IDL
documentation,
* especially the External Development Guide.
*
* NOT EVERYTHING IN THIS FILE IS A STABLE PUBLIC INTERFACE.
* For various technical reasons, there are things in this file
that
* are considered to be private to Research Systems and subject to
* immediate change without notice. Anything in this file that is
not
* explicitly documented elsewhere falls into this category. You
should
* not use such interfaces, as they are not publically supported
and
* may change or disappear without warning.
*
* Examples of such interfaces are:
* - Types and constants that are not discussed in the
documentation.
* - Functions that are not discussed elsewhere.
* - Fields of structures that are not discussed in the
documentation
* even though the structure itself *is* documented.
*/
The date 2003 and disclaimer notwithstanding, I press ahead since I
can't find anything more current.
So, at the command line compiler:
cl -D_DLL -DWIN32 -D_MT -I RHTgrCamera" -nologo /c RHTgrCamera.c" /
Fo"RHTgrCamera.obj"
creates a RHTgrCamera.obj file OK
Then at the linker:
link /out:"RHTgrCamera.dll" /nologo /nodefaultlib /dll
"RHTgrCamera.obj" /def:"RHTgrCamera.def" \RSI\IDL63\bin
\bin.x86\idl.lib msvcrt.lib kernel32.lib
At first this would fail because the .def file could not be found to I
just created one (thanks to Haje's post):
LIBRARY "RHTgrCamera"
EXPORTS IDL_Load @1
Once the def file is created the linker finishes with no errors
and .dll, .dll.manifest, .exp, .lib files are created. I then put
the .dll and .dlm files in the /bin/bin.x86/ folder. At this point I
thought I may have pulled it off but when I try to run an application
that uses the .dll I get "This application has failed to start because
MSVCR80.dll was not found. Re-installing the application may fix this
problem" However, MSVCR80.dll is in my C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0 de06acd
folder (and another folder with an equally messy path).
Am I way off here? Any guidance would be *greatly* appreciated.
Thanks,
Bill
|
|
|