Board index » off-topic » compilling own codewright dll

compilling own codewright dll


2004-02-04 11:01:39 PM
off-topic18
Hello,
i'm trying to build my own DLL for codewright. only problem is i'm already stuck with the sample. i'm using Visual Studio.NET 2002 but i cant seem to compile the sample (or any other codewright dll). i used the sample code from the SAMPLE dir from the install dir. they are linkage errors:
codewright-test-dll error LNK2019: unresolved external symbol "int __stdcall _CRT_INIT(struct HINSTANCE__ *,unsigned long,void *)" (?_CRT_INIT@@YGHPAUHINSTANCE__@@KPAX@Z) referenced in function "int __stdcall DLLEntry(struct HINSTANCE__ *,unsigned long,void *)" (?DLLEntry@@YGHPAUHINSTANCE__@@KPAX@Z)
and
codewright-test-dll error LNK2019: unresolved external symbol _LibExport@4 referenced in function "void __stdcall _init(void)" (?_init@@YGXXZ)
could anyone point me in the right direction, coz this is making me nuts :)
thank you for your time,
Bob
 
 

Re:compilling own codewright dll

If you are using CodeWright 7.5 or later then you must have the "SDK"
installed in order to compile your own DLL. The major interface component
that is needed to resolve a multitude of references is only available in the
"SDK". You have to ask Borland to get a copy of the "SDK".
If you are using CodeWright 7.0c or earlier then it should work correctly
for you if you use (as an example) the Visual Studio 6 C compiler.
Visual Studio .NET 2002 does not have a C compiler.
1
Which version of CodeWright are you using?
PDKTM (please don't kill the messenger)
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
"Bob" < XXXX@XXXXX.COM >wrote in message
Quote

Hello,

i'm trying to build my own DLL for codewright. only problem is i'm already
stuck with the sample. i'm using Visual Studio.NET 2002 but i cant seem to
compile the sample (or any other codewright dll). i used the sample code
from the SAMPLE dir from the install dir. they are linkage errors:
Quote

codewright-test-dll error LNK2019: unresolved external symbol "int
__stdcall _CRT_INIT(struct HINSTANCE__ *,unsigned long,void *)"
(?_CRT_INIT@@YGHPAUHINSTANCE__@@KPAX@Z) referenced in function "int
__stdcall DLLEntry(struct HINSTANCE__ *,unsigned long,void *)"
(?DLLEntry@@YGHPAUHINSTANCE__@@KPAX@Z)
Quote

and

codewright-test-dll error LNK2019: unresolved external symbol _LibExport@4
referenced in function "void __stdcall _init(void)" (?_init@@YGXXZ)

could anyone point me in the right direction, coz this is making me nuts
:)

thank you for your time,

Bob

 

Re:compilling own codewright dll

Hi Thom,
i'm using Codewright 6.6 and as told earlier i'm using Visual C++ .NET from the Visual Studio.NET 2002 package. i pointed the linker to all the .lib files i could find in the Codewright directory, that solved one error. now i only have the first error (se below, the "large" one) left.
hope you can come up with something with this info, because i'm starting to run out of ideas.
Bob
"Thom Little" < XXXX@XXXXX.COM >wrote:
Quote
If you are using CodeWright 7.5 or later then you must have the "SDK"
installed in order to compile your own DLL. The major interface component
that is needed to resolve a multitude of references is only available in the
"SDK". You have to ask Borland to get a copy of the "SDK".

If you are using CodeWright 7.0c or earlier then it should work correctly
for you if you use (as an example) the Visual Studio 6 C compiler.

Visual Studio .NET 2002 does not have a C compiler.
1
Which version of CodeWright are you using?

PDKTM (please don't kill the messenger)

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Bob" < XXXX@XXXXX.COM >wrote in message
news:40210953$ XXXX@XXXXX.COM ...
>
>Hello,
>
>i'm trying to build my own DLL for codewright. only problem is i'm already
stuck with the sample. i'm using Visual Studio.NET 2002 but i cant seem to
compile the sample (or any other codewright dll). i used the sample code
from the SAMPLE dir from the install dir. they are linkage errors:
>
>codewright-test-dll error LNK2019: unresolved external symbol "int
__stdcall _CRT_INIT(struct HINSTANCE__ *,unsigned long,void *)"
(?_CRT_INIT@@YGHPAUHINSTANCE__@@KPAX@Z) referenced in function "int
__stdcall DLLEntry(struct HINSTANCE__ *,unsigned long,void *)"
(?DLLEntry@@YGHPAUHINSTANCE__@@KPAX@Z)
>
>and
>
>codewright-test-dll error LNK2019: unresolved external symbol _LibExport@4
referenced in function "void __stdcall _init(void)" (?_init@@YGXXZ)
>
>could anyone point me in the right direction, coz this is making me nuts
:)
>
>thank you for your time,
>
>Bob
>


 

{smallsort}

Re:compilling own codewright dll

well, i fixed the linking problem. i switched from c++ to a c compiler and it works. only i'm not able to call my own dll functions. what i did is the following:
- made the dll
- compiled (succesfully)
- created a .def file (by hand, dont know if there is some tool for this)
- copied both files to the codewright dir
- from codewright: Customize|Libraries and added the dll form the code write dir.
what know... i cant call it from a API command or Macro and neither can i attach it to a keymap.
plz advise
Bob
"Bob" < XXXX@XXXXX.COM >wrote:
Quote

Hi Thom,

i'm using Codewright 6.6 and as told earlier i'm using Visual C++ .NET from the Visual Studio.NET 2002 package. i pointed the linker to all the .lib files i could find in the Codewright directory, that solved one error. now i only have the first error (se below, the "large" one) left.

hope you can come up with something with this info, because i'm starting to run out of ideas.

Bob

"Thom Little" < XXXX@XXXXX.COM >wrote:
>If you are using CodeWright 7.5 or later then you must have the "SDK"
>installed in order to compile your own DLL. The major interface component
>that is needed to resolve a multitude of references is only available in the
>"SDK". You have to ask Borland to get a copy of the "SDK".
>
>If you are using CodeWright 7.0c or earlier then it should work correctly
>for you if you use (as an example) the Visual Studio 6 C compiler.
>
>Visual Studio .NET 2002 does not have a C compiler.
>1
>Which version of CodeWright are you using?
>
>PDKTM (please don't kill the messenger)
>
>--
>-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
>--
>
>"Bob" < XXXX@XXXXX.COM >wrote in message
>news:40210953$ XXXX@XXXXX.COM ...
>>
>>Hello,
>>
>>i'm trying to build my own DLL for codewright. only problem is i'm already
>stuck with the sample. i'm using Visual Studio.NET 2002 but i cant seem to
>compile the sample (or any other codewright dll). i used the sample code
>from the SAMPLE dir from the install dir. they are linkage errors:
>>
>>codewright-test-dll error LNK2019: unresolved external symbol "int
>__stdcall _CRT_INIT(struct HINSTANCE__ *,unsigned long,void *)"
>(?_CRT_INIT@@YGHPAUHINSTANCE__@@KPAX@Z) referenced in function "int
>__stdcall DLLEntry(struct HINSTANCE__ *,unsigned long,void *)"
>(?DLLEntry@@YGHPAUHINSTANCE__@@KPAX@Z)
>>
>>and
>>
>>codewright-test-dll error LNK2019: unresolved external symbol _LibExport@4
>referenced in function "void __stdcall _init(void)" (?_init@@YGXXZ)
>>
>>could anyone point me in the right direction, coz this is making me nuts
>:)
>>
>>thank you for your time,
>>
>>Bob
>>
>
>

 

Re:compilling own codewright dll

I am still not totally sure what you are doing.
A good place to start is with the sample. Get the sample compiled and run
and then you will have the "environment" established for your own DLL
development.
Perhaps the only thing you are missing is "loading" your DLL. You do that
in the Library section of configuration. There are libraries you can select
at the top of the dialog box (yours will not be listed) or you can search
for them in the bottom of the dialog.
All this dialog does is to insert a LibPreLoad statement into cwright.ini
for your DLL. If it is in the CodeWright root it will be something like ...
LibPreLoad=tlaLocal.dll
You can see them at the beginning of your cwright.ini file.
If you plan to include the functions in other DLLs then you need to move the
.LIB and .EXP files that are created to the CodeWright LIB/WIN32 directory.
The prototype ...
int DLL locOutputWindow( void );
,... is obviously optional in this sample.
To reference the function from another DLL you would use a prototype of ...
CW_DECLSPEC int DLL locOutputWindow( void );
... in the calling module.
A simple example follows. After compiling and adding the LibPreLoad
statement you can execute the function with>>locOutputWindow( );<<
-------- tlaLocal.c
// -------------------------------------------------------------------------
--------------
//
// tlaLocal.dll
//
// -------------------------------------------------------------------------
--------------
#include <windows.h>
#include "exports.h"
#include "cwstart.h"
int DLL locOutputWindow( void );
LIBMAIN
// -------------------------------------------------------------------------
--------------
// _init - Register External DLL Functions
// -------------------------------------------------------------------------
--------------
void DLL _init( )
{
LibExport( "int locOutputWindow( void )" );
return ;
}
// -------------------------------------------------------------------------
--------------
// locOutputWindow
// -------------------------------------------------------------------------
--------------
int DLL locOutputWindow( void )
{
return ( OutputWindow( 8 ) );
}
// -------------------------------------------------------------------------
--------------
// 2003.02.06 10:51 Copyright ?1993-2003 - Thom Little Associates, Ltd. -
www.tlaNET.net
-------- tlaLocal.def
LIBRARY tlaLocal
DESCRIPTION 'tlaLocal.dll'
;CODE READ SHARED EXECUTE
;DATA READ WRITE
EXPORTS
_init @2
locOutputWindow@3
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
"Bob" < XXXX@XXXXX.COM >wrote in message
Quote

well, i fixed the linking problem. i switched from c++ to a c compiler and
it works. only i'm not able to call my own dll functions. what i did is the
following:
Quote

- made the dll
- compiled (succesfully)
- created a .def file (by hand, dont know if there is some tool for this)
- copied both files to the codewright dir
- from codewright: Customize|Libraries and added the dll form the code
write dir.

what know... i cant call it from a API command or Macro and neither can i
attach it to a keymap.

plz advise

Bob

"Bob" < XXXX@XXXXX.COM >wrote:
 

Re:compilling own codewright dll

well oke, i can just shoot myself, i already did all the stuff you said, but coz of my lazyness i copy & pasted the LibExport line for multiple methods and changed the parameters, but forgot to change the method names.
thnx for your patience and your help
Bob
"Thom Little" < XXXX@XXXXX.COM >wrote:
Quote
I am still not totally sure what you are doing.

A good place to start is with the sample. Get the sample compiled and run
and then you will have the "environment" established for your own DLL
development.

Perhaps the only thing you are missing is "loading" your DLL. You do that
in the Library section of configuration. There are libraries you can select
at the top of the dialog box (yours will not be listed) or you can search
for them in the bottom of the dialog.

All this dialog does is to insert a LibPreLoad statement into cwright.ini
for your DLL. If it is in the CodeWright root it will be something like ...

LibPreLoad=tlaLocal.dll

You can see them at the beginning of your cwright.ini file.

If you plan to include the functions in other DLLs then you need to move the
.LIB and .EXP files that are created to the CodeWright LIB/WIN32 directory.

The prototype ...
int DLL locOutputWindow( void );
,... is obviously optional in this sample.



To reference the function from another DLL you would use a prototype of ...

CW_DECLSPEC int DLL locOutputWindow( void );

... in the calling module.


A simple example follows. After compiling and adding the LibPreLoad
statement you can execute the function with>>locOutputWindow( );<<

-------- tlaLocal.c


// -------------------------------------------------------------------------
--------------
//
// tlaLocal.dll
//
// -------------------------------------------------------------------------
--------------

#include <windows.h>
#include "exports.h"
#include "cwstart.h"
int DLL locOutputWindow( void );
LIBMAIN

// -------------------------------------------------------------------------
--------------
// _init - Register External DLL Functions
// -------------------------------------------------------------------------
--------------

void DLL _init( )
{
LibExport( "int locOutputWindow( void )" );
return ;
}

// -------------------------------------------------------------------------
--------------
// locOutputWindow
// -------------------------------------------------------------------------
--------------

int DLL locOutputWindow( void )
{
return ( OutputWindow( 8 ) );
}

// -------------------------------------------------------------------------
--------------
// 2003.02.06 10:51 Copyright ?1993-2003 - Thom Little Associates, Ltd. -
www.tlaNET.net




-------- tlaLocal.def
LIBRARY tlaLocal
DESCRIPTION 'tlaLocal.dll'

;CODE READ SHARED EXECUTE
;DATA READ WRITE

EXPORTS
_init @2
locOutputWindow@3



--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Bob" < XXXX@XXXXX.COM >wrote in message
news:402214fa$ XXXX@XXXXX.COM ...
>
>well, i fixed the linking problem. i switched from c++ to a c compiler and
it works. only i'm not able to call my own dll functions. what i did is the
following:
>
>- made the dll
>- compiled (succesfully)
>- created a .def file (by hand, dont know if there is some tool for this)
>- copied both files to the codewright dir
>- from codewright: Customize|Libraries and added the dll form the code
write dir.
>
>what know... i cant call it from a API command or Macro and neither can i
attach it to a keymap.
>
>plz advise
>
>Bob
>
>"Bob" < XXXX@XXXXX.COM >wrote:


 

Re:compilling own codewright dll

Did you also make sure the number after the @ in .DEF are unique?
I'm rather {*word*7}about it. I have the functions sorted by name in the .C
file and the functions sorted by name in the .DEF file. I then increment
the .DEF numbers by 1 starting at 2.
This makes finding the stuff a little easier.
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
"Bob" < XXXX@XXXXX.COM >wrote in message
Quote

well oke, i can just shoot myself, i already did all the stuff you said,
but coz of my lazyness i copy & pasted the LibExport line for multiple
methods and changed the parameters, but forgot to change the method names.
Quote

thnx for your patience and your help

Bob

"Thom Little" < XXXX@XXXXX.COM >wrote:
>I am still not totally sure what you are doing.
>
>A good place to start is with the sample. Get the sample compiled and
run
>and then you will have the "environment" established for your own DLL
>development.
>
>Perhaps the only thing you are missing is "loading" your DLL. You do
that
>in the Library section of configuration. There are libraries you can
select
>at the top of the dialog box (yours will not be listed) or you can search
>for them in the bottom of the dialog.
>
>All this dialog does is to insert a LibPreLoad statement into cwright.ini
>for your DLL. If it is in the CodeWright root it will be something like
...
>
>LibPreLoad=tlaLocal.dll
>
>You can see them at the beginning of your cwright.ini file.
>
>If you plan to include the functions in other DLLs then you need to move
the
>.LIB and .EXP files that are created to the CodeWright LIB/WIN32
directory.
>
>The prototype ...
>int DLL locOutputWindow( void );
>,... is obviously optional in this sample.
>
>
>
>To reference the function from another DLL you would use a prototype of
...
>
>CW_DECLSPEC int DLL locOutputWindow( void );
>
>... in the calling module.
>
>
>A simple example follows. After compiling and adding the LibPreLoad
>statement you can execute the function with>>locOutputWindow( );<<
>
>-------- tlaLocal.c
>
>

// ------------------------------------------------------------------------
-
>--------------
>//
>// tlaLocal.dll
>//

// ------------------------------------------------------------------------
-
>--------------
>
>#include <windows.h>
>#include "exports.h"
>#include "cwstart.h"
>int DLL locOutputWindow( void );
>LIBMAIN
>

// ------------------------------------------------------------------------
-
>--------------
>// _init - Register External DLL Functions

// ------------------------------------------------------------------------
-
>--------------
>
>void DLL _init( )
>{
>LibExport( "int locOutputWindow( void )" );
>return ;
>}
>

// ------------------------------------------------------------------------
-
>--------------
>// locOutputWindow

// ------------------------------------------------------------------------
-
>--------------
>
>int DLL locOutputWindow( void )
>{
>return ( OutputWindow( 8 ) );
>}
>

// ------------------------------------------------------------------------
-
>--------------
>// 2003.02.06 10:51 Copyright ?1993-2003 - Thom Little Associates,
Ltd. -
>www.tlaNET.net
>
>
>
>
>-------- tlaLocal.def
>LIBRARY tlaLocal
>DESCRIPTION 'tlaLocal.dll'
>
>;CODE READ SHARED EXECUTE
>;DATA READ WRITE
>
>EXPORTS
>_init @2
>locOutputWindow@3
>
>
>
>--
>-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
>--
>
>"Bob" < XXXX@XXXXX.COM >wrote in message
>news:402214fa$ XXXX@XXXXX.COM ...
>>
>>well, i fixed the linking problem. i switched from c++ to a c compiler
and
>it works. only i'm not able to call my own dll functions. what i did is
the
>following:
>>
>>- made the dll
>>- compiled (succesfully)
>>- created a .def file (by hand, dont know if there is some tool for
this)
>>- copied both files to the codewright dir
>>- from codewright: Customize|Libraries and added the dll form the code
>write dir.
>>
>>what know... i cant call it from a API command or Macro and neither can
i
>attach it to a keymap.
>>
>>plz advise
>>
>>Bob
>>
>>"Bob" < XXXX@XXXXX.COM >wrote:
>
>