hard as hell
huntergeen
Posts: 38
I don't write C++ as a routine, but now I have to create a .dll. I went through the documentation in the doc and tried to compile it, but I encountered tons of errors. Does anyone have a main.cpp I can use? I just need the .dll to load in DAZ, no need for any functions.
Comments
Have you looked at the SDK example script?
I was able to compile the sample projects with VS 2010 Express and VS 2012 Express.
I would not try to use any newer compilers, as the SDK hasn't been updated in many years. Well, I haven't tried to update it since getting it compiled anyway.
I seem to recall that we have been told that daz does use a more recent version, with the 2010 libraries enabled (I can't recall thee xact term).
I think I'm so ignorant of Win32 development that I didn't know it was impossible to use VS2022, and so I did it :) If I recall, the only thing I had to do was to track down the 2010 runtime. Please DO NOT download this from any site other than Microsoft's.
Getting a pluginmain.cpp from somebody would be no different to using one of the samples. You will have the same errors.
There are issues with using a library/toolset later than 2010(v100 i.e.C++98).
I have built test DLL's using v140(C++14), 90% of their functionality worked fine. However some things did not and were very hard to work out why(basically DAZ4 is based on C++98 not C++11[or later]). Occasionally with a lot of work I was able to code around some of the problems, but not all. There are a number of threads in this forum about the subject of library and IDE compatibility.
I use 2010(v100) and MS VStudio 2017. With DAZ4 I have given up trying to build with, or use/link to any library not based on C++98.
For me, I had a different set of issues with using an IDE later than 2017(MS VStudio2017). With a bit of work I should be able to wind 2022 back to function like 2017, however I then lose all the nice 2022 functionality for any other non DAZ4 project. For me it is simple enough to open DAZ4 projects in VS2017 and other projects in VS2022.
I think as TheMysteryIsThePoint said others have found that MS VStudio 2022 works fine for them.
If you have CMAKE, V100 and a MS VStudio the samples should compile and work fine and give you an excellent base from which to build your own dll for DAZ4.
That said I do recall how frustrating it was to have to,
find and install the V100 libraries,
register the SDK,
build the project files and folders with CMAKE,
then open one or more of the sample projects in MS Studio and
change the project setting to V100 (MS VStudio wants to use its default)
so that you can then build the DLL.
I'm able to use different C++ standards on a per file basis. Such an old verion of Qt doesn't build with 17 onwards, but by segregating the Qt references to the degree possible, I can actually get some compilation units to compile with the latest C++ standard supported by VS2022, which I think is 23.
I'm sorry that I didn't keep good records of what I did. For some reason I just haven't had any problems with VS2022 at all and don't know enough about Win32 development to know the reason why not. I'll be honest and say that if I could figure it out, then any competent Win32 dev should be able to...
But in any case, you want to write an exporter, right, because of an issue with Sagan's UVs on Geografts? While your kind of moxie is awesome, I think you might not be giving the proper "respect" for the volume work you are in for (Sagan has a sloc count of around 5400 lines), how frustrating it's going to be because the documentation is nonexistent, it is not going to be clear how certain very basic things work, what certain concepts even mean and what they a for, and it will be AGGRAVATING not knowing if your code is correct or just simply works under the small set of scenarios under which you tested it.
For that reason, I strongly urge you to instead work with me on Sagan, instead of starting at square 0. I'm about to release v3.6 and I've long said that I would give the source to anyone that wanted it. No one has wanted it. This is how open source is supposed to work: Sagan should give you 95% of what you need, and if you understand something better than me, I (and Sagan's user base) would be grateful for any improvements or new functionality you produced. The most important benefit is that through blood, sweat, tears, and the help of others not affiliated with DAZ (other than Richard Haseltine, of course), I've figured out much of this stuff, and while I can't help you write the code, I can answer many of your questions or at least give you some kind of insight.
Please, try to get your environment squared away, and then let's talk. We'll get you to where you want to be.
Oh, and you'll probably be interested in a plugin shim I wrote so that you can load/unload your plugin without having to restart DAZ Studio every time.