Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# MFC
Hi
 
i made a dll in C# with Class Library project.
this dll has one function.
then i added this dll in an MFC project with Add Reference.
then i define a variable with type Mydll::Class1.
while this definition is placed in a function, there is no problem but when i want to define it as global or member variable of class i got an error.
 
the help offers this message:
You can only define CLR objects within function scope
 
is there any solution to define a global variable?
 
thanks
Posted 25-Jun-12 21:08pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

this link [^]might help you!
  Permalink  
Comments
Moharram at 2-Jul-12 0:37am
   
this link is useful for COM base dll but my dll isn't COM base.
ThatsAlok at 2-Jul-12 9:47am
   
I doubt you can achieve that in plain vanila way!. See you are trying to export class, which is not possible straight forward.
 
I See you are MFC programmer, have you heard about MFC extension library these DLL are only capable of exporting class without com support for rest COM is only way. otherwise you wrap you dll and provide plain method to export data

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Gihan Liyanage 338
2 ChauhanAjay 180
3 Vinay Mistry 160
4 Sergey Alexandrovich Kryukov 153
0 Sergey Alexandrovich Kryukov 9,011
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100