471,350 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Can not find the resource

Hello, dear guys,
I met another curious issue of finding the resources.

There was a dynamic file, which include a resource:
/////////////////////////////////////////////////////////////////////////////
//
// RCDATA
//

IDR_FX_CLASSICMATERIAL RCDATA "..\\Shaders\
\ClassicMaterial.fx"

And, the app could load the dll, and working fine.

But, I convert it into the the static lib, then it broken down. I
check the code in the library, the error was in FindResource function:
HRSRC hResource = ::FindResource(gModule,
MAKEINTRESOURCE(IDR_FX_CLASSICMATERIAL), RT_RCDATA);
The return value was zero. I don't know why this happen if it's static
library.
The error message was : "The speicified type cannot be found in the
image file"

I first guest maybe it's HINSTANCE fault, but when I add the header
IMAGE_DOS_HEADER, it still the same fault.
Have you met this issue before?

Jun 27 '07 #1
5 1761
Ed
On Jun 27, 4:45 pm, David Lowndes <Dav...@example.invalidwrote:
There was a dynamic file, which include a resource:
/////////////////////////////////////////////////////////////////////////////
//
// RCDATA
//
IDR_FX_CLASSICMATERIAL RCDATA "..\\Shaders\
\ClassicMaterial.fx"
And, the app could load the dll, and working fine.
But, I convert it into the the static lib, then it broken down. I
check the code in the library, the error was in FindResource function:
HRSRC hResource = ::FindResource(gModule,
MAKEINTRESOURCE(IDR_FX_CLASSICMATERIAL), RT_RCDATA);
The return value was zero. I don't know why this happen if it's static
library.
The error message was : "The speicified type cannot be found in the
image file"

The problem is that a static library can't contain any resources.
Unfortunately the tools don't do anything to tell you that, so it's
easy to assume you ought to be able to do it. :(

Dave
Is there something workaround to make static library contain the
resources?
And it seems there are many restrict of the conversion from dynamic
lib to static lib in MS.

Jun 27 '07 #2
>There was a dynamic file, which include a resource:
>/////////////////////////////////////////////////////////////////////////////
//
// RCDATA
//

IDR_FX_CLASSICMATERIAL RCDATA "..\\Shaders\
\ClassicMaterial.fx"

And, the app could load the dll, and working fine.

But, I convert it into the the static lib, then it broken down. I
check the code in the library, the error was in FindResource function:
HRSRC hResource = ::FindResource(gModule,
MAKEINTRESOURCE(IDR_FX_CLASSICMATERIAL), RT_RCDATA);
The return value was zero. I don't know why this happen if it's static
library.
The error message was : "The speicified type cannot be found in the
image file"
The problem is that a static library can't contain any resources.
Unfortunately the tools don't do anything to tell you that, so it's
easy to assume you ought to be able to do it. :(

Dave
Jun 27 '07 #3
Ed
On Jun 27, 2:53 pm, sealo <seah...@gmail.comwrote:
Hello, dear guys,
I met another curious issue of finding the resources.

There was a dynamic file, which include a resource:
/////////////////////////////////////////////////////////////////////////////
//
// RCDATA
//

IDR_FX_CLASSICMATERIAL RCDATA "..\\Shaders\
\ClassicMaterial.fx"

And, the app could load the dll, and working fine.

But, I convert it into the the static lib, then it broken down. I
check the code in the library, the error was in FindResource function:
HRSRC hResource = ::FindResource(gModule,
MAKEINTRESOURCE(IDR_FX_CLASSICMATERIAL), RT_RCDATA);
The return value was zero. I don't know why this happen if it's static
library.
The error message was : "The speicified type cannot be found in the
image file"

I first guest maybe it's HINSTANCE fault, but when I add the header
IMAGE_DOS_HEADER, it still the same fault.
Have you met this issue before?
And this module do not use MGC dll, so AfxFindResourceHandle can not
be used here.

Jun 27 '07 #4
>Is there something workaround to make static library contain the
>resources?
No, they can't if they're resources. You'd have to arrange to separate
out the resources and include them more directly into the project
you're linking your static library to. Alternatively, include them as
data in the code.

Dave
Jun 27 '07 #5

"Ed" <se*****@gmail.comwrote in message
news:11**********************@o11g2000prd.googlegr oups.com...
On Jun 27, 4:45 pm, David Lowndes <Dav...@example.invalidwrote:
>There was a dynamic file, which include a resource:
/////////////////////////////////////////////////////////////////////////////
//
// RCDATA
//
>IDR_FX_CLASSICMATERIAL RCDATA "..\\Shaders\
\ClassicMaterial.fx"
>And, the app could load the dll, and working fine.
>But, I convert it into the the static lib, then it broken down. I
check the code in the library, the error was in FindResource function:
HRSRC hResource = ::FindResource(gModule,
MAKEINTRESOURCE(IDR_FX_CLASSICMATERIAL), RT_RCDATA);
The return value was zero. I don't know why this happen if it's static
library.
The error message was : "The speicified type cannot be found in the
image file"

The problem is that a static library can't contain any resources.
Unfortunately the tools don't do anything to tell you that, so it's
easy to assume you ought to be able to do it. :(

Dave

Is there something workaround to make static library contain the
resources?
A compiled resource, aka .res file, does for resources what a .lib does for
code. You'll have to distribute both.
And it seems there are many restrict of the conversion from dynamic
lib to static lib in MS.

Jun 27 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Craig | last post: by
2 posts views Thread by Booster | last post: by
reply views Thread by klemen.verdnik | last post: by
2 posts views Thread by Jasper | last post: by
2 posts views Thread by steve | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.