Re: Converting .lib to .dll
- From: "Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 19 Jun 2008 17:59:43 +0100
Thanks for the tips. We are in a bit of a hurry - but I do take your point
and when we have more time I will look at this in more detail.
Andy Baker
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:u7q82li0IHA.4416@xxxxxxxxxxxxxxxxxxxxxxx
Right. So the code there, until you include that header file, does not
know about GetCurrentConfig(). This would be the equivalent of you
referencing a method of a managed class when the namespace was not
referenced with a 'using' statement (C#) or 'Imports' statement (VB.NET),
and wasn't in the list of references for the project.
Adding the header file to the project does nothing. That's a convenience
for you to quickly open the file, but that's it. Header files are *only*
useful when they are #include-ed in actual .cpp or .c files. They are not
compiled separately. If you've added that #include statement and compiled
the .cpp file to which you added it, it seems that it should be defined.
However, as with managed code, there are many ways in which things that
seem like they should be defined might not be (there might be some #if
statements in the header that prevent the compiler from seeing the
declaration unless you define some symbol for the compiler, for example).
Without having the file in front of us, I don't think we're going to hit
on the right answer.
I'm not on the OpenNETCF staff; I just know that they know what they're
doing. Neil is one of the guys to talk to about that. I would not expect
it to be very expensive, if they're just doing the DLL and not the
P/Invoke declarations. Maybe a little more to give you a complete managed
code solution. If you're in a hurry, that's absolutely the right way to
go. If you have some weeks in which to get this completed, learning
what's going on, how to read C/C++ header and source files, how to build
DLLs in native code, etc. will make you a much better .NET CF developer in
the long run.
Paul T.
"Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx> wrote in message
news:-pmdnUq5MIfVGMfVnZ2dneKdnZydnZ2d@xxxxxxxxxx
The function that I am trying to call is as follows:-
VPSUMMIT_API SDCERR VP_GetCurrentConfig(DWORD *num, char *name)
{
return GetCurrentConfig(num, name)
}
and the error message I am getting is error C3861: 'GetCurrentConfig': -
identifier not found.
If I select Project/Compile I still get the error, J have added #include
<sdc_sdk.h> to the source file though. When I created the project, VC++
created 2 files VPSummit.cpp and VPSummit.h. I have added the supplied
header file sdc_sdk.h to the project, and changed the lines in the
sdc_sdk.h file and the VPSummit.cpp file by adding VP_ to each function
definition. If I replace the 'return GetCurrentConfig(num, name)' line in
the above call with 'return SDCERR_SUCCESS' and build the project, I get
a DLL file. If I inspect the DLL file with dumpbin, I can 'see' the
function definitions that I have exposed, all with the VP_ prefix, as I
was expecting. Also, as the error message refers to GetCurrentConfig and
not VP_GetCurrentConfig, this suggests to me that the definitions in the
header file are correct and for some reason it is not finding the sdk.lib
file, even though I have added it to the linker additional dependencies.
Please correct me if I am wrong, I obviously am wrong somewhere!
I am really inexperienced with C/C++ - you can probably tell that, so
I agree it probably would be best to get someone to do it, especially in
the first instance. This is what the hardware suppliers were going to do,
but don't have time at present and the longer it goes on, the worse it is
getting for us. What charges do OpenNETCF consulting make for doing jobs
like this and how long would it take? I will put it to the boss. Thanks
for your help so far.
Andy Baker
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:elvfsHi0IHA.2068@xxxxxxxxxxxxxxxxxxxxxxx
Give us the full error. You have something like this in your code, yes?
EXPORT_SETTING int VP_DoWhatever( int parameter1, int parameter2 )
{
return DoWhatever( parameter1, parameter2 );
}
And when you compile this, you get 'DoWhatever undefined' during
*compile*? Or during link?
If compile, it seems that you forgot to add #include
<yoursummitheader.h> to the source file, right?
If link, it seems that you probably forgot to add the LIB file to your
list of linked inputs for the project (this goes on the Link page in the
project settings).
If you're really inexperienced with C/C++, you might be better off just
having someone who knows how to do this in their sleep do it for you and
give you the DLL source and project back in a finished form, ready to be
called from managed code. OpenNETCF Consulting, I'm sure, would do
it...
Paul T.
.
- References:
- Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Neil Cowburn
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Neil Cowburn
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Neil Cowburn
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Paul G. Tobey [eMVP]
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Neil Cowburn
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Neil Cowburn
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Paul G. Tobey [eMVP]
- Re: Converting .lib to .dll
- From: Andy Baker
- Re: Converting .lib to .dll
- From: Paul G. Tobey [eMVP]
- Converting .lib to .dll
- Prev by Date: EventWaitHandle & CeRunAppAtEvent
- Next by Date: ANN: Smart Device Development chat on MSDN starts in 30 minutes
- Previous by thread: Re: Converting .lib to .dll
- Next by thread: Re: Converting .lib to .dll
- Index(es):
Relevant Pages
|
|