I'm using the MSVC C++ compiler.
Any help is greatly appreciated.
Thanks
-SR
Sent via Deja.com
http://www.deja.com/
hotp...@my-deja.com wrote:
--
Michal Baranski
BSiPE "Energoprojekt-Katowice" SA
mailto:baransk...@energoprojekt.com.pl
cu
Enrico Penetti
Michal Baranski schrieb in Nachricht
<3A791CA4...@energoprojekt.com.pl>...
I am including the mdlbltin.lib and the paths are ok. I think it has to
do with the strict type checking which happens in C++.
For e.g:
In the include file dlmsys.fdf there is the function definition
int dlmSystem_callMdlFunction
(
MdlDesc *pMdlFileDesc,
MdlFunctionP pFunc,
...
);
& in mdl.h depending on the preprocessor directive
# if defined (mdl)
MdlFunctionP is either
typedef int (*MdlFunctionP)();
# else
typedef void *MdlFunctionP;
#endif
And this is what makes it break while trying to link because the
Microsoft Visual C++ linker tries to do a strict(exact) type matching
with the definition in the mdl libraries (mdlbltin.lib) & crashes.
So, my question is have any of youbeen able to resolve this -say by
using extern "c" or something like that.
Thanks
-SR
In article <95e2t1$go9ks$1...@ID-25655.news.dfncis.de>,
It sort of casts the c++ file as a c file.
In article <95ck5c$d4q$1...@nnrp1.deja.com>,
In article <95ehk1$49$1...@nnrp1.deja.com>,
hopeth...@my-deja.com wrote:
> Put this line at the top of your c++ file below your #include's:
> #define DLLEXPORT extern "C" __declspec( dllexport )
>
> It sort of casts the c++ file as a c file.
>
> In article <95ck5c$d4q$1...@nnrp1.deja.com>,
> hotp...@my-deja.com wrote:
> > I'm trying to compile a C++ file as a DLL in MDL & I'm having
problems
> > in linking. I took a look at the mdlvc sample in Bentley
developerware
> > site but I see that it uses only a C file.
> > extpnt.obj : error LNK2001: unresolved external symbol "int __cdecl
> > dlmSystem_callMdlFunction(struct mdlDesc *,void *,...)" (?
#define DLLEXPORT extern "C" __declspec( dllexport )
/*----------------------------------------------------------------------
+
|
| name winstart
|
+----------------------------------------------------------------------*
/
DLLEXPORT int winstart
(
char *theProgram
)
{
/* See Win32 Programmer's reference on STARTUPINFO */
STARTUPINFO start;
PROCESS_INFORMATION proc;
start.cb = sizeof(STARTUPINFO);
start.lpReserved =NULL;
start.lpDesktop=NULL;
start.lpTitle=NULL;
start.cbReserved2 = 0;
/* Create a new process using Win32API */
if (false==CreateProcess ( NULL, theProgram,
NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &start,
&proc))
{
return false;
}
else
{
/* Wait for the application to start up */
WaitForInputIdle (proc.hProcess, 10000);
CloseHandle (proc.hProcess);
CloseHandle (proc.hThread);
return true;
}
}
DLLEXPORT int initialize
(
void
)
{
/* This function simplifies compiling with DLMLINK.MKI */
return 0;
}
In article <95eiee$r6$1...@nnrp1.deja.com>,
I'm still at square 1.
Thanks for your input though.
-SR
In article <95ek0b$2em$1...@nnrp1.deja.com>,
You may try to make a hybride:
put whatever causes headache in .c,
keep the rest in .cpp, compile both
and link together.
(.c will be your 'wrapper' code calling MDL)
HTH
--
Best Regards,
/Chris Zakrewsky
<hotp...@my-deja.com> wrote in message news:95eoe8$6s9$1...@nnrp1.deja.com...
#include <basedefs.h>
#include <dloadlib.h>
#include <dlmfuncs.h>
#include <mssystem.fdf>
#include <dlmsys.fdf>
#ifdef __cplusplus
}
#endif
#endif // MDL
------
and with the settings where in the other mail i have written.
Sometimes you must the order changes in which the libs are linking.
hotp...@my-deja.com schrieb in Nachricht <95eh7f$vl6$1...@nnrp1.deja.com>...
-SR
#ifdef MDL // MDL-Unterstützung (this is declared by me)
#ifdef __cplusplus
extern "C" {
#endif
#define DLLEXPORT extern "C" __declspec( dllexport )
#ifdef __cplusplus
}
#endif
#endif // MDL
In article <95lofv$hrles$1...@ID-25655.news.dfncis.de>,
Best regards
Ambrosa
File called :MDLLib.cpp
********************
#include "stdafx.h"
extern "C"{
// mdl communication include
#define winNT
#include "mssystem.fdf"
#include "dlmsys.fdf"
#define MDLCALL __stdcall
}
mdlDesc *mdlDescP = NULL; // Pointer to Call back MDL module
MdlFunctionP func = 0L; // Pointer to MDL function
int MDLCALL mdl_setCall(MdlFunctionP mdlFunc){
if ((func = mdlFunc) && (mdlDescP = mdlSystem_getCurrMdlDesc()))
return true;
return false;
}
int MDLCALL mdl_call(short counter){
if ((func) && (mdlDescP))
return dlmSystem_callMdlFunction(mdlDescP,func,counter);
return FALSE;
}
"Chris Zakrewsky" <ch...@cadperf.se> wrote in message
news:aRbf6.1373$u7....@nntpserver.swip.net...