calling dll native entry point for mixed assemblies

Paul Gofman gofmanp at gmail.com
Tue Jan 26 14:57:38 CST 2016


On 01/26/2016 11:42 PM, Vincent Povirk wrote:
>> So then I will split this patch into two or three, look couple of times
>> more and send it.
> It seemed like one logical change to me, I don't think it needs
> splitting. (Except for the change to FixupVTable which seems
> unrelated.)
Shouldn't I add flag to winnt.h in a separate patch?
The change I made to FixupVTable is for avoiding calling times
assembly_from_hmodule twice when called from _CorDllMain (which involves
extra heap allocation/free). If you think it is not an issue I can
simplify the patch and do not touch FixupVTable. Or change FixupVTable
as first part, then the main change as the next part.

>
> How can I build a DLL to test this? The default managed c++ dll
> doesn't seem to include an entry point.
>
I suppose the simplest way to test it to make mixed mode C++ DLL with
native C++ class with printf in constructor, and static instance of the
class defined globally in DLL. And whatever in managed part which would
be called from some normal DLL native exported function. Native entry
point RVA should be in corhdr->EntryPointRVA of the DLL (while PE32
normal entry point just jumps to _CorDllMain). Unfortunately I still
cannot build mixed mode DLLs myself and do not have exactly that test
case, but the mixed mode dlls I have in the simplified test case I
posted to Mono bug (https://bugzilla.xamarin.com/show_bug.cgi?id=37913)
have native entry point.





More information about the wine-devel mailing list