Click here to Skip to main content
15,885,182 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I found a very interesting article here on CP: Really cool visual FX[^]

The effects are stunning, and I would REALLY like to be able to use them in a C# application I'm doing (for the About form, I should think). Just for fun, really - and because I like the effects...

AFAIK, it's possible to compile C++ code to a dll and use it in a C# project, but I have never actually tried it.

I started out thinking: "What the hell, how different can C++ be from C#? Surely, it must be possible to find out how to do it without having to learn an entirely new (old) language..." - I WAS WRONG! C++ is so f***ing confusing, with all the diffent files and stuff. I'm way out of my league.

Can some C++ wiz please point me in the right direction? How do I compile the C++ code to a dll that can be used in a C# project?

I tried adding all the files to a Win32 project, and I managed to resolve a few simple issues myself (method overloading), but when I compile now, I only get:

"error LNK1169: one or more multiply defined symbols found c:\users\johnny\Documents\_Visual Studio Projects\VisualSfx\Debug\VisualSfx.dll 1 1 VisualSfx"

and

"error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj) c:\Users\Johnny\Documents\_Visual Studio Projects\VisualSfx\VisualSfx\mfcs120ud.lib(dllmodul.obj) VisualSfx"

How do I resolve that?
Posted

1 solution

It is going to be a nightmare if you have not used VC++ before. A quick advice is to forward the source to a friend who knows VC++ and ask him to create a COM dll :) Once you have a COM dll the rest is simple and you can find plenty of articles that explains how to consume a COM DLL in C# project.
 
Share this answer
 
Comments
Johnny J. 10-Jun-15 9:25am    
I have no friends... :-(
At least no friends that know C++ ;-)

But I believe you...
_Asif_ 10-Jun-15 9:35am    
Unfortunately, don't have time otherwise would have done the favour :)
Johnny J. 10-Jun-15 9:36am    
That's ok, I understand... :-)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900