Ok, this is not necessary with VS2005...
I have now a mixed DLL. But when I load it with LoadLibrary from unmanaged
code I have the following Error:
193 : %1 is not a valid Win32 application.
Ouch !
> Thanks for that.
> Should I follow the following ? http://support.microsoft.com/?id=814472
[quoted text clipped - 18 lines]
>> Regards, Vadym Stetsyak
>> www: http://vadmyst.blogspot.com
Hello, Olivier!
Hmm, strange. Do you have DllMain function in your dll?
Is it called?
You wrote on Fri, 24 Nov 2006 18:46:53 +0100:
OM> Ok, this is not necessary with VS2005...
OM> I have now a mixed DLL. But when I load it with LoadLibrary from
OM> unmanaged
OM> code I have the following Error:
OM> 193 : %1 is not a valid Win32 application.
OM> Ouch !
OM> "Olivier Matrot" <olivier.matrot.rte@online.nospam> wrote in message
OM> news:uzX$61%23DHHA.4048@TK2MSFTNGP02.phx.gbl...
>> Thanks for that.
>> Should I follow the following ?
>> http://support.microsoft.com/?id=814472
>> I may be wrong but the sample you provider is not what I'm looking
>> for.
>>> Hello, Olivier!
>>> Yes, it is possible.
>>> To compile with managed code use /clr compiler parameter.
>>> And here's code sample
>>> ( http://www.winterdom.com/mcppfaq/archives/000370.html )
>>> OM> I have a VC++ Project that outputs an unmanaged DLL.
>>> OM> I would like to convert this project to a managed C++ Project.
>>> OM> The goal is to mix unmanaged and managed code. Un unmanaged
>>> exported
>>> OM> function will need to run managed code. Is it possible ?
>>> OM> TIA.
>>> --
>>> Regards, Vadym Stetsyak
>>> www: http://vadmyst.blogspot.com
--
With best regards, Vadym Stetsyak.
Blog: http://vadmyst.blogspot.com
Olivier MATROT - 26 Nov 2006 21:05 GMT
This a a visual studio 2003 upgraded MFC DLL.
I've only added a managed C++ class to the project...
> Hello, Olivier!
>
[quoted text clipped - 41 lines]
> With best regards, Vadym Stetsyak.
> Blog: http://vadmyst.blogspot.com
Gary Chang[MSFT] - 27 Nov 2006 05:46 GMT
Hi Olivier,
>This a a visual studio 2003 upgraded MFC DLL.
>I've only added a managed C++ class to the project...
Based on the error message: 193 : %1 is not a valid Win32 application.
The problem seems to be your mixed DLL is not a valid Win32 image. Is it
possible that the DLL is built by any 64-bit version's library?
If you just upgrade that MFC DLL to VS2005, is there any problem to load it?
By the way, the KB article you mention does not target on your case, it
discuss the scenario that the original DLL is a pure .NET assembly.
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Olivier Matrot - 27 Nov 2006 08:28 GMT
There is no problem to load the DLL, if there is no CLR module module in the
project.
As soon as I add a Managed C++ Class, the DLL does not load anymore.
> Hi Olivier,
>
[quoted text clipped - 37 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Olivier Matrot - 27 Nov 2006 16:44 GMT
My fault.
I started from scratch with this project. Now the DLL is successfully
loaded.
My problem now is to call a static managed function from unmanaged code (an
unmanaged exported C style function).
> There is no problem to load the DLL, if there is no CLR module module in
> the project.
[quoted text clipped - 43 lines]
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
Olivier Matrot - 27 Nov 2006 18:00 GMT
Nothing special to do for calling managed code from unmanaged code.
Thanks for that.
> My fault.
> I started from scratch with this project. Now the DLL is successfully
[quoted text clipped - 53 lines]
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.